The API provides to retrieve all available request counters using a GET request. The counter information is provided per month in a chronological descending order.

Request

URL:

/api/2.2/[user]/[apiHash_User]/requestcounters/

Required Header:

Accept: application/json

Possible Query Parameters

The request is paginated. Therefore you can add pagination parameters "offset" (default: 0) and "length" (default: 100).

parameterexampledescription
offset
/api/2.2/[user]/[apiHash_User]/requestcounters/?offset=10

specifies the position from which possible counter results should be provided

minimal value: 0

length
/api/2.2/[user]/[apiHash_User]/requestcounters/?offset=10&length=20

specified the number of counts which have to be provided at maximum

supported range: 0-100

Response

The status code of the response will be 200 if all parameters are correctly specified. Otherwise an error code is provided.

The body contains a list of all available request counters. 

{
"count": 123,
"requestCounters":
   [
     {
      "monthYear": "201403",
      "counter": 23321
     },
     ...
   ]
}

PHP API Client

The PHP API client supports to get the stored request counters for all months:

<?php
include_once("ContentOnTarget-PHP-API-Client.php");
$config = com\repalogic\ContentOnTarget\Client\Configuration::getConfig("https://api.shopontarget.com/", "userName", "userApiHash", "core name does not matter", "core api hash does not matter");

$requestApi= new com\repalogic\ContentOnTarget\Client\CoreUserRequestCounterApi($config);
$requestList = $requestApi->getRequestCounters();
var_dump($requestList);
?>

 

It is also possible to query the request counter using administration credentials:

<?php
include_once("ContentOnTarget-PHP-API-Client.php");
$config = com\repalogic\ContentOnTarget\Client\Configuration::getConfig("https://api.shopontarget.com/", "user name does not matter", "user api hash does not matter", "core name does not matter", "core api hash does not matter");
$adminCredentials = new com\repalogic\ContentOnTarget\Client\AdministrationCredentials("adminUser", "adminPassword");
$requestApi= new com\repalogic\ContentOnTarget\Client\CoreUserRequestCounterAdministrationApi($config, adminCredentials);
$requestList = $requestApi->getRequestCounters();
var_dump($requestList);
?>