Sub League

Retrieves the authenticated RoadLeagues user sub league for a specified custom sub league ID. The custom sub league ID {CLID} parameter is required for this endpoint. The {CLID} can be retrieved from the Sub League List endpoint response.

Method URI
GET https://roadleagues.com/api/v1/sub-league?token={ACCESS-TOKEN}&clid={CLID}
POST https://roadleagues.com/api/v1/sub-league


Required POST Headers

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


POST Data Parameters

"clid" : "{CLID}", // Required - Integer


Example Success Response

{
    "data": {
        "clid": 1,
        "leagueID": 2,
        "name": "Sub League Test",
        "description": "Sub league test description",
        "subSlugName": "sub-league-test",
        "leaderboardPhoto": "https://roadleagues.com/uploads/league/leaderboard/custom/WA5XiExdeU4pnMmZeRw.jpg",
        "isActive": "yes",
        "displayOrder": 1,
        "raceGroupsAssigned": [
            "1",
            "2"
        ],
        "createdDate": "2020-02-21 13:05:47",
        "lastUpdated": "2020-03-16 12:03:14"
    },
    "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-league",
  data: {
    "clid": "{CLID}", // Required
  },
  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-league",
  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 => "clid={CLID}",
  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;