我想弄清楚为什么我似乎无法使用 eBay API 更新跟踪号码。这是我正在引用的页面:
http://developer.ebay.com/DevZone/merchant-data/CallRef/SetShipmentTrackingInfo.html
基于此,我在Perl中有以下代码:
use Net::eBay;
my $ebay = new Net::eBay( {
SiteLevel => 'prod',
DeveloperKey => 'x',
ApplicationKey => 'xxxx',
CertificateKey => 'xxx',
Token => 'xxxx',
} );
$ebay->setDefaults( { API => 2, compatibility => 900 } );
my $result = $ebay->submitRequest( "SetShipmentTrackingInfoRequest",
{
DetailLevel => "ReturnAll",
ErrorLevel => "1",
SiteId => "1",
OrderID => 1234546, # not the real order ID I'm using :)
ShipmentTrackingDetails => {
ShipmentTrackingNumber => "12345",
ShippingCarrierUsed => "Hermes"
}
});
print $IN->header;
use Data::Dumper;
print Dumper($result);
运行时,我在$ result中收到错误:
$VAR1 = {
'Errors' => {
'ErrorClassification' => 'RequestError',
'SeverityCode' => 'Error',
'ShortMessage' => 'Unsupported API call.',
'ErrorCode' => '2',
'LongMessage' => 'The API call "SetShipmentTrackingInfoRequest" is invalid or not supported in this release.'
},
'xmlns' => 'urn:ebay:apis:eBLBaseComponents',
'Timestamp' => '2016-10-21 07:03:04',
'Build' => '18007281',
'Version' => '900',
'Ack' => 'Failure'
};
我有点困惑,因为看起来SetShipmentTrackingInfoRequest
是我需要进行的API调用?我对eBay API做的并不多,所以我可能会错过一些愚蠢的东西。
更新:根据以下反馈,我现在正在使用CompleteSale
API调用:
http://developer.ebay.com/Devzone/XML/docs/Reference/eBay/CompleteSale.html
my $ result = $ ebay-> submitRequest(“CompleteSale”, { DetailLevel => “ReturnAll” ErrorLevel => “1”, SiteId => “1”, OrderID => 1933420817015, 发货=> { ShipmentTrackingDetails => { ShipmentTrackingNumber => “77293124902615”, ShippingCarrierUsed => “爱马仕” } } });
当我运行它时,我现在收到错误:
'LongMessage'=> 'XML Error Text:“;嵌套异常是: org.xml.sax.SAXParseException:与元素类型“CompleteSale”关联的属性名称“Request”必须后跟 \'= \'字符。“。',
启用调试时,发送的XML是:
<?xml version='1.0' encoding='utf-8'?>
<CompleteSale Request xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>xxxx</eBayAuthToken>
</RequesterCredentials>
<DetailLevel>ReturnAll</DetailLevel>
<ErrorLevel>1</ErrorLevel>
<OrderID>xxxxx</OrderID>
<Shipment>
<ShipmentTrackingDetails>
<ShipmentTrackingNumber>xxxx</ShipmentTrackingNumber>
<ShippingCarrierUsed>Hermes</ShippingCarrierUsed>
</ShipmentTrackingDetails>
</Shipment>
<SiteId>1</SiteId>
</CompleteSale Request>
答案 0 :(得分:2)
通过查看您发布的eBay API doc链接,第二个'注意'是否完全解释了为什么它不能作为单个API调用工作?
注意:SetShipmentTrackingInfo不能像使用端点的普通API调用一样自行发布
然后继续说:
在Trading API中,CompleteSale调用提供了可以直接调用的类似功能
所以也许应该看下一步