Sub League List

Retrieves the authenticated RoadLeagues users sub leagues list for a specified league. The main league ID {LID} parameter is required for this endpoint. The {LID} for the specified league can be retrieved from the League List endpoint response.

Method URI
GET https://roadleagues.com/api/v1/sub-leagues?token={ACCESS-TOKEN}&lid={LID}&paginate=20
POST https://roadleagues.com/api/v1/sub-leagues


Required POST Headers

{
  "Accept"        : "application/json",
  "Content-Type"  : "application/x-www-form-urlencoded",
  "Authorization" : "Bearer {ACCESS-TOKEN}"
}


POST Data Parameters

"lid" : "{LID}", // Required - Integer
"paginate" : "20", // Optional - Integer


Example Response

{
    "data": [
        {
            "clid": 1,
            "leagueID": 2,
            "name": "Sub League One",
            "description": "Sub league one description",
            "subSlugName": "sub-league-one",
            "leaderboardPhoto": "https://roadleagues.com/uploads/league/leaderboard/custom/WA5XiExdeUdwsMmZeRw.jpg",
            "isActive": "yes",
            "displayOrder": 1,
            "raceGroupsAssigned": [
                "1",
                "2"
            ],
            "createdDate": "2020-02-21 13:05:47",
            "lastUpdated": "2020-03-16 12:09:14"
        },
        {
            "clid": 2,
            "leagueID": 2,
            "name": "Sub League Two",
            "description": "Sub league two description",
            "subSlugName": "sub-league-two",
            "leaderboardPhoto": null,
            "isActive": "no",
            "displayOrder": 2,
            "raceGroupsAssigned": [
                "3",
                "4"
            ],
            "createdDate": "2020-01-01 15:10:42",
            "lastUpdated": "2020-01-01 10:03:64"
        }
    ],
    "links": {
        "first": "https://roadleagues.com/api/v1/sub-leagues?page=1",
        "last": "https://roadleagues.com/api/v1/sub-leagues?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://roadleagues.com/api/v1/sub-leagues",
        "per_page": 20,
        "to": 2,
        "total": 2
    },
    "extra": {
        "api_author": "Richie McMullen",
        "api_version": "v1",
        "api_rate_limit": null,
        "current_limit_count": null
    }
}

Example Requests

{primary} A couple of examples using Ajax & PHP cURL on how you might go about making a POST request for this endpoint. Remember to replace the placeholders with your own credentials.

Example POST Request - Ajax

$.ajax({
  type: "POST",
  url: "https://roadleagues.com/api/v1/sub-leagues",
  data: {
    "lid": "{LID}", // Required
    "paginate": "20", // Optional
  },
  headers: {
    "Accept": 'application/json',
    "Content-Type": 'application/x-www-form-urlencoded',
    "Authorization": 'Bearer {ACCESS-TOKEN}',
  },
  dataType: "JSON",
  cache: false,
  success: function (data) {
    console.log(data);
  }
});


Example POST Request - PHP cURL

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://roadleagues.com/api/v1/sub-leagues",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "lid={LID}&paginate=20",
  CURLOPT_HTTPHEADER => array(
    "Accept: application/json",
    "Content-Type: application/x-www-form-urlencoded",
    "Authorization: Bearer {ACCESS-TOKEN}"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;