Perl 中的 eBay API - 无法使用 SetShipmentTrackingInfoRequest 更新跟踪信息
eBay API in Perl - can't use SetShipmentTrackingInfoRequest to update tracking information
我想弄清楚为什么我似乎无法使用 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
我的 $result = $ebay->submitRequest( "CompleteSale ",
{
详细级别 => "ReturnAll",
错误级别 => "1",
站点 ID => "1",
订单编号 => 1933420817015,
装运 => {
ShipmentTrackingDetails => {
ShipmentTrackingNumber => "77293124902615",
ShippingCarrierUsed => "Hermes"
}
}
});
当我 运行 它时,我现在得到错误:
'LongMessage' => 'XML Error Text: "; nested exception is:
org.xml.sax.SAXParseException: Attribute name "Request" associated with an element type "CompleteSale" must be followed by the
\' = \' character.".',
启用调试,正在发送的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>
通过查看您发布的 eBay API doc link,第二个 'Note' 是否完全解释了为什么它不能作为单个 API 调用?
Note: SetShipmentTrackingInfo cannot be issued on its own like an ordinary API call, using an endpoint
接着说:
In the Trading API, the CompleteSale call provides similar functionality that you can invoke directly
所以也许应该看看下一步
我想弄清楚为什么我似乎无法使用 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
我的 $result = $ebay->submitRequest( "CompleteSale ", { 详细级别 => "ReturnAll", 错误级别 => "1", 站点 ID => "1", 订单编号 => 1933420817015, 装运 => { ShipmentTrackingDetails => { ShipmentTrackingNumber => "77293124902615", ShippingCarrierUsed => "Hermes" } } });
当我 运行 它时,我现在得到错误:
'LongMessage' => 'XML Error Text: "; nested exception is: org.xml.sax.SAXParseException: Attribute name "Request" associated with an element type "CompleteSale" must be followed by the \' = \' character.".',
启用调试,正在发送的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>
通过查看您发布的 eBay API doc link,第二个 'Note' 是否完全解释了为什么它不能作为单个 API 调用?
Note: SetShipmentTrackingInfo cannot be issued on its own like an ordinary API call, using an endpoint
接着说:
In the Trading API, the CompleteSale call provides similar functionality that you can invoke directly
所以也许应该看看下一步