The Analytics API retrieves call-limit data and the quotas that are set for the RESTful APIs and the legacy Trading API.
Responses from calls made to getRateLimits and getUerRateLimits include a list of the applicable resources and the "call limit", or quota, that is set for each resource. In addition to quota information, the response also includes the number of remaining calls available before the limit is reached, the time remaining before the quota resets, and the length of the "time window" to which the quota applies.
The getRateLimits and getUserRateLimits methods retrieve call-limit information for either an application or user, respectively, and each method must be called with an appropriate OAuth token. That is, getRateLimites requires an access token generated with a client credentials grant and getUserRateLimites requires an access token generated with an authorization code grant. For more information, see <a href="/api-docs/static/oauth-tokens.html">OAuth tokens.
Users can analyze the response data to see whether or not a limit might be reached, and from that determine if any action needs to be taken (such as programmatically throttling their request rate). For more on call limits, see <a href="https://developer.ebay.com/support/app-check " target="_blank">Compatible Application Check.
PHP 7.4 and later. Should also work with PHP 8.0.
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
}
],
"require": {
"GIT_USER_ID/GIT_REPO_ID": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php
:
<?php
require_once('/path/to/EbayDeveloperAnalyticsApi/vendor/autoload.php');
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: api_auth
$config = Modstore\EbayDeveloperAnalyticsApi\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
// Configure OAuth2 access token for authorization: api_auth
$config = Modstore\EbayDeveloperAnalyticsApi\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Modstore\EbayDeveloperAnalyticsApi\Api\RateLimitApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$api_context = 'api_context_example'; // string | This optional query parameter filters the result to include only the specified API context. <br><br><b>Valid values:</b> <ul><li><code>buy</code></li><li><code>sell</code></li> <li><code>commerce</code></li><li><code>developer</code></li><li><code>tradingapi</code></li></ul>
$api_name = 'api_name_example'; // string | This optional query parameter filters the result to include only the APIs specified. <br><br><b>Example values:</b> <ul> <li><code>browse</code> for the <a href=\"/../develop/apis/restful-apis/buy-apis#buy-apis\" target=\"_blank\">Buy APIs</a></li> <li><code>inventory</code> for the <a href=\"/../develop/apis/restful-apis/sell-apis#sell-apis\" target=\"_blank\">Sell APIs</a></li> <li><code>taxonomy</code> for the <a href=\"/../develop/apis/restful-apis/commerce-apis#commerce-apis\" target=\"_blank\">Commerce APIs</a></li> <li><code>tradingapi</code> for the <a href=\"/../Devzone/XML/docs/Reference/eBay/index.html\" target=\"_blank\">Trading APIs</a></li></ul>
try {
$result = $apiInstance->getRateLimits($api_context, $api_name);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling RateLimitApi->getRateLimits: ', $e->getMessage(), PHP_EOL;
}
All URIs are relative to https://api.ebay.com/developer/analytics/v1_beta
Class | Method | HTTP request | Description |
---|---|---|---|
RateLimitApi | getRateLimits | GET /rate_limit/ | |
UserRateLimitApi | getUserRateLimits | GET /user_rate_limit/ |
- Type:
OAuth
- Flow:
application
- Authorization URL: ``
- Scopes:
- https://api.ebay.com/oauth/api_scope: View public data from eBay
- Type:
OAuth
- Flow:
accessCode
- Authorization URL:
https://auth.ebay.com/oauth2/authorize
- Scopes:
- https://api.ebay.com/oauth/api_scope/commerce.catalog.readonly: This scope would allow signed in user to read catalog data.
- https://api.ebay.com/oauth/api_scope/sell.marketing.readonly: View your eBay marketing activities, such as ad campaigns and listing promotions
- https://api.ebay.com/oauth/api_scope/sell.inventory: View and manage your inventory and offers
- https://api.ebay.com/oauth/api_scope/sell.marketing: View and manage your eBay marketing activities, such as ad campaigns and listing promotions
- https://api.ebay.com/oauth/api_scope/sell.inventory.readonly: View your inventory and offers
- https://api.ebay.com/oauth/api_scope/sell.marketplace.insights.readonly: This scope would allow signed in users read only access to marketplace insights.
To run the tests, use:
composer install
vendor/bin/phpunit
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
v1_beta.0.0
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen
openapi-generator generate -i developer_analytics_v1_beta_oas3.json -g php -o ebay_developer_analytics_api --additional-properties packageName=EbayDeveloperAnalyticsApi --additional-properties invokerPackage=Modstore\\EbayDeveloperAnalyticsApi