易趣API调用REVISEITEM不工作

时间:2016-10-06 06:02:43

标签: php xml ebay-api

1 个答案:

答案 0 :(得分:-1)

我可以使用reviseitem API获得响应“成功”,这是我的代码,只需使用authToken。但是,即使响应“成功”,我要更新的字段也不会更新。似乎此API无法正常工作。

  const options = {
            method: "POST",
            headers: {
                "Content-Type": "application/xml",
                "X-EBAY-API-CALL-NAME": "ReviseItem",
                "X-EBAY-API-COMPATIBILITY-LEVEL": "967",
                "X-EBAY-API-SITEID": "15",
            },
            data: `<?xml version="1.0" encoding="utf-8"?>
          <ReviseItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
            <RequesterCredentials>
              <eBayAuthToken>${authToken}</eBayAuthToken>
            </RequesterCredentials>
             <IncludeItemSpecifics>true</IncludeItemSpecifics>
            <Item>
            <ItemID>${itemId}</ItemID>
            <ItemSpecifics> 
           <NameValueList> 
            ${nameValueList}
            </NameValueList>
          </ItemSpecifics>
            </Item>
          </ReviseItemRequest>`,
            url: "https://api.ebay.com/ws/api.dll",
        }
        const result = await axios(options)

        if (result.status === 200 && result.data) {
            const jsonResult = await parseString(result.data)
...
}