【问题标题】:Get sold items from Ebay SDK Selling - getting "Missing required input element" Error从 Ebay SDK 销售中获取已售商品 - 出现“缺少必需的输入元素”错误
【发布时间】:2016-03-23 01:29:05
【问题描述】:

我无法为 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] => 
    )

)

错误:缺少必需的输入元素。

我好像不是在要求什么,但我不知道。

【问题讨论】:

    标签: php ebay-api ebay-sdk


    【解决方案1】:

    GetItemStatus 调用要求您提供 ItemID。请参阅以下 API 参考:GetItemStatus

    您声明您正在查找销售历史记录。我不相信这是你应该使用的电话。这是一个似乎在购物 API 中的函数调用,它更像是一个产品搜索工具。

    如果您希望获取特定客户的销售历史记录,您可能希望使用“GetOrders”API 调用。请参阅以下内容:GetOrders

    【讨论】:

    • 答案是GetItemStatus需要一个Id,谢谢。不幸的是,GetOrders 仅针对登录的卖家。
    • 好消息是,我相信我已经找到了多次售出商品退货的解决方案。 (我尚未对其进行测试,但文档似乎很清楚)这是我最初工作的地方,但错过了如何正确使用过滤器,所以我提前(错误地)排除了它,因为它似乎只返回活动列表。 - findCompletedItems 将返回带有特定过滤器的已售商品,根据文档:itemFilter(2).name=SoldItemsOnly& itemFilter(2).value=true&,位于:developer.ebay.com/devzone/finding/CallRef/…
    • 很高兴听到你把它整理出来!我假设您正在为您或客户的帐户寻找销售。我的错误假设:-)
    • 我建议您指定日期边界。 eBay 会保留超过 90 天的数据,尽管数据越旧,您检索它的信心就越低;我不知道他们使用什么算法来保留和丢弃。只是我随机挑选的一个示例:列表 231780378406 于 2015 年 12 月 17 日结束,但仍可完全检索。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多