【问题标题】:eBay Trading API XML ResponseeBay 交易 API XML 响应
【发布时间】:2017-04-17 13:16:14
【问题描述】:

我正在尝试提出 getmyebaysales 请求,以便跟踪当前商品的价格和数量。

按照文档和示例here,我生成了一个令牌并尝试向生产 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.

我在这里使用他们自己的文档样本。我真正能看到的唯一时间链接是&lt;Sort&gt;TimeLeft&lt;/Sort&gt;,这有点牵强,但即使没有,我也会得到相同的响应。

我一直在使用不同的 Python 库,试图在没有太多文档的情况下让 getmyebaysales 请求正常工作。现在通过 eBay 自己的文档,我感觉自己已经死在水中了。如果有人可以将我推向正确的方向,我将不胜感激。不太确定下一步该尝试什么。

【问题讨论】:

    标签: python ebay-api


    【解决方案1】:

    API 响应错误没有什么帮助,但根据您共享的代码判断,您发出的请求缺少必需的标头字段。更多详情here

    以下更改应该为您指明正确的方向 -

    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'
    }
    

    【讨论】:

      【解决方案2】:

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

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

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

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

      ebay developer build test tool

      经过数小时的故障排除,我终于找到了我的问题:我在查询字符串中传递了所需的标头,而不是作为 http 请求标头!一年多来,它运行良好,但突然停止运行。

      道德:无效的“GeteBayOfficialTime”API 调用消息表明 http 标头有问题。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-02-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多