我无法为 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 TypesFindItemsByKeywordsRequest();
// 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: %sn", $error->message);
}
} else {
foreach ($response->searchResult->item as $item) {
printf("(%s) %s:%.2fn", $item->itemId, $item->title, $item->sellingStatus->currentPrice->value);
}
}
我的更简单(显然不完整)
$request = new TypesGetItemStatusRequestType;
$response = $service->getItemStatus();
if ($response->Ack !== 'Success') {
if (isset($response->Errors)) {
foreach ($response->Errors as $error) {
printf("Error: %sn", $error->ShortMessage);
}
}
} else {
print_r($response->getItemStatus); //should return all avail values (works with other types of requests)
}
这是令人讨厌的错误
DTSeBaySDKShoppingTypesGetItemStatusResponseType Object
(
[values:DTSeBaySDKTypesBaseType:private] => Array
(
[Timestamp] => DateTime Object
(
[date] => 2016-03-23 00:28:28.391000
[timezone_type] => 2
[timezone] => Z
)
[Ack] => Failure
[Errors] => DTSeBaySDKTypesUnboundType Object
(
[data:DTSeBaySDKTypesUnboundType:private] => Array
(
[0] => DTSeBaySDKShoppingTypesErrorType Object
(
[values:DTSeBaySDKTypesBaseType:private] => Array
(
[ShortMessage] => Missing required input element.
[LongMessage] => Required input element is missing from the request.
[ErrorCode] => 1.19
[SeverityCode] => Error
[ErrorParameters] => DTSeBaySDKTypesUnboundType Object
(
[data:DTSeBaySDKTypesUnboundType:private] => Array
(
[0] => DTSeBaySDKShoppingTypesErrorParameterType Object
(
[values:DTSeBaySDKTypesBaseType:private] => Array
(
[ParamID] => 0
[Value] => ItemID
)
[attachment:DTSeBaySDKTypesBaseType:private] => Array
(
[data] =>
[mimeType] =>
)
)
)
[position:DTSeBaySDKTypesUnboundType:private] => 0
[class:DTSeBaySDKTypesUnboundType:private] => DTSeBaySDKShoppingTypesErrorType
[property:DTSeBaySDKTypesUnboundType:private] => ErrorParameters
[expectedType:DTSeBaySDKTypesUnboundType:private] => DTSeBaySDKShoppingTypesErrorParameterType
)
[ErrorClassification] => RequestError
)
[attachment:DTSeBaySDKTypesBaseType:private] => Array
(
[data] =>
[mimeType] =>
)
)
)
[position:DTSeBaySDKTypesUnboundType:private] => 0
[class:DTSeBaySDKTypesUnboundType:private] => DTSeBaySDKShoppingTypesGetItemStatusResponseType
[property:DTSeBaySDKTypesUnboundType:private] => Errors
[expectedType:DTSeBaySDKTypesUnboundType:private] => DTSeBaySDKShoppingTypesErrorType
)
[Build] => E949_CORE_APILW_17769283_R1
[Version] => 949
)
[attachment:DTSeBaySDKTypesBaseType:private] => Array
(
[data] =>
[mimeType] =>
)
)
错误:缺少必需的输入元素。
似乎我不是在要求什么,但我不知道。
GetItemStatus 调用要求您提供 ItemID。 请参阅以下 API 参考:获取项状态
您声明您正在寻找销售历史记录。 我不认为这是你应该使用的电话。 这是一个函数调用,似乎在购物 API 中,它更像是一个产品搜索工具。
如果您希望获得特定的帐户销售历史记录,则可能希望使用"GetOrders"API调用。 请参阅以下内容:获取订单