eBay交易API XML响应



我正在尝试提出一个getMyeBayselling请求,以便我可以跟踪当前列表的价格和数量。

遵循文档并在此处进行示例,我生成了一个令牌,并尝试向生产XML发送请求以查看我当前的列表。

当前尝试:

endpoint = "https://api.ebay.com/ws/api.dll"
xml = """<?xml version="1.0" encoding="utf-8"?>
<GetMyeBaySellingRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>AgAAAA*...full auth token here...wIAYMEFWl</eBayAuthToken>
  </RequesterCredentials>
  <Version>967</Version>
  <ActiveList>
    <Sort>TimeLeft</Sort>
    <Pagination>
      <EntriesPerPage>3</EntriesPerPage>
      <PageNumber>1</PageNumber>
    </Pagination>
  </ActiveList>
</GetMyeBaySellingRequest>"""
headers = {'Content-Type': 'application/xml'}
response = requests.post(endpoint, data=xml, headers=headers)
print response
print response.content

响应:

<?xml version="1.0" encoding="UTF-8" ?><GeteBayOfficialTimeResponse xmlns="urn:ebay:apis:eBLBaseComponents"><Timestamp>2017-04-17 13:01:25</Timestamp><Ack>Failure</Ack><Errors><ShortMessage>Unsupported API call.</ShortMessage><LongMessage>The API call "GeteBayOfficialTime" is invalid or not supported in this release.</LongMessage><ErrorCode>2</ErrorCode><SeverityCode>Error</SeverityCode><ErrorClassification>RequestError</ErrorClassification></Errors><Build>18007282</Build></GeteBayOfficialTimeResponse>

该响应的有用部分:

The API call "GeteBayOfficialTime" is invalid or not supported in this release.

我在这里从他们自己的文档示例中工作。我真正能看到的时间的唯一链接是<Sort>TimeLeft</Sort>,这是一个伸展的链接,但即使没有,我也得到了相同的回应。

我正在与不同的python libs一起努力,试图在没有太多文档的情况下获得getMyeBayselly请求。现在在eBay本身的文档上,我感到很死在水中。如果有人能朝着正确的方向推动我,我会很感激。不确定接下来要做什么。

API响应错误略大一点,但是根据您共享的代码,您正在使用缺少所需的标头字段的代码来判断。更多详细信息

以下更改应指向正确的方向 -

headers = {
    'X-EBAY-API-COMPATIBILITY-LEVEL': '<compat_level>',
    'X-EBAY-API-CALL-NAME': '<api_call_name>',
    'X-EBAY-API-SITEID': '<api_siteid>',
    'Content-Type': 'application/xml'
}

突然我开始收到错误消息:

The API call "GeteBayOfficialTime" is invalid or not supported in this release.

但我没有打电话给getebayofficialtime!我遇到了问题,但是错误消息误导了。

为了确保正确获取帖子标题和内容,构建测试工具绝对有帮助:

eBay开发人员构建测试工具

进行了数小时的故障排除,我终于弄清楚了我的问题:我在查询字符串中传递了所需的标题,而不是HTTP请求标头!一年多来,它运行还可以,但突然间它停止了工作。

道德:无效的" getebayofficialtime" API呼叫消息指示HTTP标头的问题。

最新更新