1.创建eBay接入API教程网址
https://developer.ebay.com/api-docs/static/creating-edp-account.html
前言:API参考:资源
该分析API检索呼叫限制和数据被用于RESTful API中及其关联的资源设置配额。对getRateLimits和getUserRateLimits进行的调用的响应包括适用资源的列表以及为每个资源设置的“呼叫限制”或配额。除了配额信息之外,响应还包括在达到限制之前剩余可用呼叫的数量,配额重置之前剩余的时间以及配额适用的“时间窗口”的长度。
该getRateLimits和getUserRateLimits方法分别检索应用程序或用户的调用限制信息,并且必须使用适当的OAuth令牌调用每个方法。也就是说,getRateLimits需要使用客户端凭据授予生成的访问令牌,而getUserRateLimits要求需要使用授权代码授予生成的访问令牌。有关更多信息,请参阅OAuth令牌。用户可以分析响应数据以查看是否可以达到限制,并从中确定是否需要采取任何操作(例如以编程方式限制其请求率)。
一、getRateLimits
1.1 / rate_limit /
此方法检索应用程序的调用限制和利用率数据。检索所有RESTful API和资源的数据。
getRateLimits的响应包括适用资源的列表以及为每个资源设置的“呼叫限制”或配额。除了配额信息之外,响应还包括在达到限制之前剩余可用呼叫的数量,配额重置之前剩余的时间以及配额适用的“时间窗口”的长度。 默认情况下,此方法返回所有RESTful API资源的利用率数据。使用api_name和api_context查询参数仅对所需API的响应进行过滤。
请求格式:(String是内容)
HTTP请求标头
对eBay REST操作发出的所有请求都要求您提供授权 HTTP标头以进行身份验证授权。
此方法没有其他必需的标头。请参阅HTTP请求标头- 打开其余请求组件页面以获取详细信息
响应内容
响应内容说明:(rateLimits) 。例:rateLimits.APICONTEXT
返回状态码(此调用可以返回以下HTTP状态代码之一。状态代码的概述,请参阅HTTP状态代码在使用eBay RESTful API中。)
例子:输入
此方法不使用请求正文。但是,您可以使用api_name和api_context查询参数来控制响应中返回的数据。
GET https://api.ebay.com/developer/analytics/v1_beta/rate_limit/
返回内容:
对未指定任何查询参数的调用的成功请求将返回所有受支持资源的调用限制数据列表。
{"rateLimits": [{"apiContext": "buy","apiName": "Browse","apiVersion": "v1","resources": [{"name": "buy.browse","rates": [{"limit": 5000,"remaining": 5000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "buy","apiName": "Feed","apiVersion": "v1_beta","resources": [{"name": "buy.feed.snapshot","rates": [{"limit": 75000,"remaining": 75000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]},{"name": "buy.feed","rates": [{"limit": 10000,"remaining": 10000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "buy","apiName": "Marketing","apiVersion": "v1_beta","resources": [{"name": "buy.marketing","rates": [{"limit": 5000,"remaining": 5000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "buy","apiName": "Order","apiVersion": "v1","resources": [{"name": "buy.order","rates": [{"limit": 5000,"remaining": 5000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "commerce","apiName": "Catalog","apiVersion": "v1_beta","resources": [{"name": "commerce.catalog","rates": [{"limit": 20000000,"remaining": 20000000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "commerce","apiName": "Taxonomy","apiVersion": "v1","resources": [{"name": "commerce.taxonomy","rates": [{"limit": 5000,"remaining": 5000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "developer","apiName": "Analytics","apiVersion": "v1_beta","resources": [{"name": "developer.analytics.app_rate_limit"},{"name": "developer.analytics.user_rate_limit"}]},{"apiContext": "sell","apiName": "Account","apiVersion": "v1","resources": [{"name": "sell.account","rates": [{"limit": 25000,"remaining": 25000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "sell","apiName": "Analytics","apiVersion": "v1","resources": [{"name": "sell.analytics","rates": [{"limit": 100,"remaining": 100,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400},{"limit": 500,"remaining": 500,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "sell","apiName": "Compliance","apiVersion": "v1","resources": [{"name": "sell.compliance.violation_summary","rates": [{"limit": 5000,"remaining": 5000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]},{"name": "sell.compliance.violation","rates": [{"limit": 5000,"remaining": 5000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "sell","apiName": "Fulfillment","apiVersion": "v1","resources": [{"name": "sell.fulfillment","rates": [{"limit": 100000,"remaining": 100000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "sell","apiName": "Inventory","apiVersion": "v1","resources": [{"name": "sell.inventory","rates": [{"limit": 2000000,"remaining": 2000000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "sell","apiName": "Marketing","apiVersion": "v1","resources": [{"name": "sell.marketing","rates": [{"limit": 10000,"remaining": 10000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]},{"name": "sell.marketing.ad_report_task"},{"name": "sell.marketing.ad_report"}]},{"apiContext": "sell","apiName": "Marketplace Insights","apiVersion": "v1","resources": [{"name": "sell.marketplace.insights"}]},{"apiContext": "sell","apiName": "Metadata","apiVersion": "v1","resources": [{"name": "sell.metadata","rates": [{"limit": 5000,"remaining": 5000,"reset": "2018-08-06T07:00:00.000Z","timeWindow": 86400}]}]}]
}
二、getUserRateLimits(/ user_rate_limit /)
OAuth范围
此请求需要使用授权代码授权流创建的访问令牌,使用以下列表中的一个或多个范围(请查看“应用程序密钥”页面以获取应用程序可用的OAuth范围列表):
https://api.ebay.com/oauth/api_scope/sell.inventory
https://api.ebay.com/oauth/api_scope/sell.inventory.readonly
https://api.ebay.com/oauth/api_scope/sell.marketplace.insights.readonly
https://api.ebay.com/oauth/api_scope/commerce.catalog.readonly
https://api.ebay.com/oauth/api_scope/sell.marketing
https://api.ebay.com/oauth/api_scope/sell.marketing.readonly
响应内容
响应内容说明:(rateLimits),例:rateLimits.APICONTEXT
返回状态码(此调用可以返回以下HTTP状态代码之一。状态代码的概述,请参阅HTTP状态代码在使用eBay RESTful API中。)
此方法不使用请求正文。但是,您可以使用api_name和api_context查询参数来控制响应中返回的数据。
GET https://api.ebay.com/developer/analytics/v1_beta/user_rate_limit/
对未指定任何查询参数的调用的成功请求将返回所有受支持资源的调用限制数据列表。
{"rateLimits": [{"apiContext": "commerce","apiName": "Catalog","apiVersion": "v1_beta","resources": [{"name": "commerce.catalog","rates": [{"limit": 1000,"remaining": 1000,"reset": "2018-08-07T07:00:00.000Z","timeWindow": 86400}]}]},{"apiContext": "sell","apiName": "Marketing","apiVersion": "v1","resources": [{"name": "sell.marketing.ad_report_task","rates": [{"limit": 25,"remaining": 25,"reset": "2018-08-07T17:00:00.000Z","timeWindow": 3600}]},{"name": "sell.marketing.ad_report","rates": [{"limit": 25,"remaining": 25,"reset": "2018-08-07T17:00:00.000Z","timeWindow": 3600}]}]}]
}
API错误和警告响应
发送请求后,您可以收到三种不同类型的响应组件。根据请求处理期间发生的情况,您可以收到错误或警告,如下所示:
有一个warnings组件,没有errors组件。在处理期间未发生错误但发生一个或多个警告时会发生这种情况。
有一个errors组件,没有warnings组件。处理期间发生一个或多个错误时会发生这种情况。虽然在处理期间也可能发生警告,但它们不包含在具有错误组件的任何响应中。
没有一个errors或warnings组件。在处理期间没有警告和错误发生时会发生这种情况。
返回的错误和警告对象是相同的类型(ErrorData)并具有相同的字段。
请注意,某些ErrorData字段采用自定义类型,如下所示:
ErrorCategory:使用三个值(Request,Business或Application)之一来指示遇到的问题类型。
ErrorParameter:有两个必填字段,两个字符串,命名name和value。
异常列表
最常遇到的常见错误列表:
此文档由Chrome浏览器翻译,本人整理,原文网址请前往 ------链接