我无法为EbaySDK创建标记,因此Ebay API可能会产生误导。 SDK参考文献如下。
为什么有些请求需要"输入"他们在哪里可以找到? SDK注意事项似乎并不清楚每个"呼叫类型"所需的内容。
根据http://devbay.net/sdk/guides/getting-started/basic-usage.html#working-with-responses的示例,我试图获取已售商品的清单。由于Ebay仅保留90天的数据,因此我对我的请求没有任何限制。
他们的示例请求是:
// Create the API request object.
$request = new Types\FindItemsByKeywordsRequest();
// Assign the keywords.
$request->keywords = 'Harry Potter';
// Output the response from the API.
if ($response->ack !== 'Success') {
foreach ($response->errorMessage->error as $error) {
printf("Error: %s\n", $error->message);
}
} else {
foreach ($response->searchResult->item as $item) {
printf("(%s) %s:%.2f\n", $item->itemId, $item->title, $item->sellingStatus->currentPrice->value);
}
}
我的更简单(显然不完整)
$request = new Types\GetItemStatusRequestType;
$response = $service->getItemStatus();
if ($response->Ack !== 'Success') {
if (isset($response->Errors)) {
foreach ($response->Errors as $error) {
printf("Error: %s\n", $error->ShortMessage);
}
}
} else {
print_r($response->getItemStatus); //should return all avail values (works with other types of requests)
}
这是令人讨厌的错误
DTS\eBaySDK\Shopping\Types\GetItemStatusResponseType Object
(
[values:DTS\eBaySDK\Types\BaseType:private] => Array
(
[Timestamp] => DateTime Object
(
[date] => 2016-03-23 00:28:28.391000
[timezone_type] => 2
[timezone] => Z
)
[Ack] => Failure
[Errors] => DTS\eBaySDK\Types\UnboundType Object
(
[data:DTS\eBaySDK\Types\UnboundType:private] => Array
(
[0] => DTS\eBaySDK\Shopping\Types\ErrorType Object
(
[values:DTS\eBaySDK\Types\BaseType:private] => Array
(
[ShortMessage] => Missing required input element.
[LongMessage] => Required input element is missing from the request.
[ErrorCode] => 1.19
[SeverityCode] => Error
[ErrorParameters] => DTS\eBaySDK\Types\UnboundType Object
(
[data:DTS\eBaySDK\Types\UnboundType:private] => Array
(
[0] => DTS\eBaySDK\Shopping\Types\ErrorParameterType Object
(
[values:DTS\eBaySDK\Types\BaseType:private] => Array
(
[ParamID] => 0
[Value] => ItemID
)
[attachment:DTS\eBaySDK\Types\BaseType:private] => Array
(
[data] =>
[mimeType] =>
)
)
)
[position:DTS\eBaySDK\Types\UnboundType:private] => 0
[class:DTS\eBaySDK\Types\UnboundType:private] => DTS\eBaySDK\Shopping\Types\ErrorType
[property:DTS\eBaySDK\Types\UnboundType:private] => ErrorParameters
[expectedType:DTS\eBaySDK\Types\UnboundType:private] => DTS\eBaySDK\Shopping\Types\ErrorParameterType
)
[ErrorClassification] => RequestError
)
[attachment:DTS\eBaySDK\Types\BaseType:private] => Array
(
[data] =>
[mimeType] =>
)
)
)
[position:DTS\eBaySDK\Types\UnboundType:private] => 0
[class:DTS\eBaySDK\Types\UnboundType:private] => DTS\eBaySDK\Shopping\Types\GetItemStatusResponseType
[property:DTS\eBaySDK\Types\UnboundType:private] => Errors
[expectedType:DTS\eBaySDK\Types\UnboundType:private] => DTS\eBaySDK\Shopping\Types\ErrorType
)
[Build] => E949_CORE_APILW_17769283_R1
[Version] => 949
)
[attachment:DTS\eBaySDK\Types\BaseType:private] => Array
(
[data] =>
[mimeType] =>
)
)
错误:缺少必需的输入元素。
似乎我没有问过要求,但我不知道。
答案 0 :(得分:0)
GetItemStatus调用要求您提供ItemID。请参阅以下API参考:GetItemStatus
您声明您正在寻找销售历史记录。我不相信这是你应该使用的电话。这是一个似乎位于购物API中的函数调用,它更像是一个产品搜索工具。
你可能想要使用' GetOrders'如果您希望获得特定帐户销售历史记录,请拨打API电话。请参阅以下内容:GetOrders