home > support > API > Marketplace API > API: rate limit status
Check hit limits for GET/POST current API requests (i.e. not currently throttled). Remaining hits are also returned in the response header to every call.
Also useful for check if you can connect correctly to the API.
Calls to this API do not count towards your throttle limit.
Endpoint | /api/rate_limit_status |
Formats | XML |
Example | /api/rate_limit_status.xml |
Verb | GET |
PHP examples use the PHP Client Library with the return type set to SimpleXML
object api_rate_limit_status ( [ int $channel = 0 ] )
// Set the Channel ID
// For Suppliers this can be found in the API settings page
// For Partners this will be 0
$channel_id = 0;
// Query the TourCMS API
$result = $tc->api_rate_limit_status($channel_id);
// Print out the remaining hits for GET and POST requests
print 'GET remaining hits: ' . $result->remaining_hits;
print 'POST remaining hits: ' . $result->remaining_hits_post;
GET remaining hits: 500
POST remaining hits: 1900
C# examples use the .Net Client Library
XmlDocument ApiRateLimitStatus ()
XmlDocument ApiRateLimitStatus (int channelId)
// Set the Channel ID
// For Suppliers this can be found in the API settings page
// For Partners this will be 0
int channelId = 0;
// Query the TourCMS API
XmlDocument doc = myTourCMS.ApiRateLimitStatus(channelId);
// Print out the remaining hits for GET and POST requests
string limGET = doc.GetElementsByTagName("remaining_hits")[0].innerText;
string limPOST = doc.GetElementsByTagName("remaining_hits_post")[0].innerText;
Console.WriteLine("GET remaining hits: " + limGET);
Console.WriteLine("POST remaining hits: " + limPOST);
GET remaining hits: 500
POST remaining hits: 1900
VB examples use the .Net Client Library
XmlDocument ApiRateLimitStatus ()
XmlDocument ApiRateLimitStatus (Integer ChannelId)
' Set the Channel ID
' For Suppliers this can be found in the API settings page
' For Partners this will be 0
Dim channelId As Integer = 0
' Query the TourCMS API
Dim doc As XmlDocument = myTourCMS.ApiRateLimitStatus(channelId)
' Print out the remaining hits for GET requests
Dim limGET As String = doc.GetElementsByTagName("remaining_hits")(0).InnerText
Dim limPOST As String = doc.GetElementsByTagName("remaining_hits_post")(0).InnerText
Console.WriteLine("GET remaining hits: " & limGET)
Console.WriteLine("POST remaining hits: " & limPOST)
GET remaining hits: 500
POST remaining hits: 1900
NodeJS examples use the NodeJS Wrapper
// Set the Channel ID
// For Operators this can be found in the API settings page
// For Marketplace Agents this can be 0 for general API calls
// or set to a ChannelID to see how many calls remain on that Channel
var channelId = 0;
// Query the TourCMS API
TourCMS.apiRateLimitStatus({
channelId: channelId,
callback: function(response) {
console.log("GET remaining hits: " + response.remaining_hits);
console.log("POST remaining hits: " + response.remaining_hits_post);
}
})
GET remaining hits: 500
POST remaining hits: 1900
Looking for sample code in a different language? TourCMS and community provided API libraries
Implementing yourself? Check the REST info for this endpoint.
Enter your TourCMS API credentials below to call the API Rate limit status endpoint.
There are no querystring parameters supported by this method.
XML Node | Notes |
---|---|
request | Confirmation of the request that you sent |
error | Any error message returned, if there is no error this will just contain the text OK |
remaining_hits | Number of GET remaining hits before you are throttled |
hourly_limit | Current GET requests limit per hour |
remaining_hits_post | Number of remaining POST hits before you are throttled |
hourly_limit_post | Current POST requests limit per hour |
<?xml version="1.0" encoding="UTF-8"?>
<response>
<request>GET /api/rate_limit_status.xml</request>
<error>OK</error>
<remaining_hits>2999</remaining_hits>
<hourly_limit>3000</hourly_limit>
<remaining_hits_post>2999</remaining_hits_post>
<hourly_limit_post>3000</hourly_limit_post>
</response>