davidtsadler / ebay-sdk-php

An eBay SDK for PHP. Use the eBay API in your PHP projects.
Apache License 2.0
350 stars 343 forks source link

The Feed API does not work #168

Closed vlasscontreras closed 4 years ago

vlasscontreras commented 6 years ago

When trying to execute a request using the given example for get_item_feed (which BTW has the feed_type value out of date as well, I used NEWLY_LISTED for this example), the SDK throws this error:

object(DTS\eBaySDK\Feed\Types\GetItemFeedRestResponse)#2565 (5) {
["values":"DTS\eBaySDK\Types\BaseType":private]=>
array(1) {
    ["errors"]=>
    object(DTS\eBaySDK\Types\RepeatableType)#2546 (5) {
    ["data":"DTS\eBaySDK\Types\RepeatableType":private]=>
    array(1) {
        [0]=>
        object(DTS\eBaySDK\Feed\Types\ErrorDetailV3)#2557 (2) {
        ["values":"DTS\eBaySDK\Types\BaseType":private]=>
        array(6) {
            ["errorId"]=>
            int(2002)
            ["domain"]=>
            string(6) "ACCESS"
            ["category"]=>
            string(7) "REQUEST"
            ["message"]=>
            string(18) "Resource not found"
            ["longMessage"]=>
            string(67) "A resource (URI) associated with the request could not be resolved."
            ["parameters"]=>
            object(DTS\eBaySDK\Types\RepeatableType)#2564 (5) {
            ["data":"DTS\eBaySDK\Types\RepeatableType":private]=>
            array(1) {
                [0]=>
                object(DTS\eBaySDK\Feed\Types\ErrorParameterV3)#2547 (2) {
                ["values":"DTS\eBaySDK\Types\BaseType":private]=>
                array(2) {
                    ["name"]=>
                    string(6) "reason"
                    ["value"]=>
                    string(125) "null for uri: https://api.sandbox.ebay.com/buy/feed/v1_beta/item_summary?category_id=625&date=20180112&feed_type=DAILY"
                }
                ["attachment":"DTS\eBaySDK\Types\BaseType":private]=>
                array(2) {
                    ["data"]=>
                    NULL
                    ["mimeType"]=>
                    NULL
                }
                }
            }
            ["position":"DTS\eBaySDK\Types\RepeatableType":private]=>
            int(0)
            ["class":"DTS\eBaySDK\Types\RepeatableType":private]=>
            string(36) "DTS\eBaySDK\Feed\Types\ErrorDetailV3"
            ["property":"DTS\eBaySDK\Types\RepeatableType":private]=>
            string(10) "parameters"
            ["expectedType":"DTS\eBaySDK\Types\RepeatableType":private]=>
            string(39) "DTS\eBaySDK\Feed\Types\ErrorParameterV3"
            }
        }
        ["attachment":"DTS\eBaySDK\Types\BaseType":private]=>
        array(2) {
            ["data"]=>
            NULL
            ["mimeType"]=>
            NULL
        }
        }
    }
    ["position":"DTS\eBaySDK\Types\RepeatableType":private]=>
    int(0)
    ["class":"DTS\eBaySDK\Types\RepeatableType":private]=>
    string(46) "DTS\eBaySDK\Feed\Types\GetItemFeedRestResponse"
    ["property":"DTS\eBaySDK\Types\RepeatableType":private]=>
    string(6) "errors"
    ["expectedType":"DTS\eBaySDK\Types\RepeatableType":private]=>
    string(36) "DTS\eBaySDK\Feed\Types\ErrorDetailV3"
    }
  }
  ...
}

And noticed that the reason is the requested resource. The SDK uses item_summary instead of item.

I changed the file /Feed/Services/FeedService.php from:

'GetItemFeed' => [
    'method' => 'GET',
    'resource' => 'item_summary',
    'responseClass' => '\DTS\eBaySDK\Feed\Types\GetItemFeedRestResponse',
    'params' => [
        'category_id' => [
            'valid' => ['string'],
            'required' => true
        ],
        'date' => [
            'valid' => ['string'],
            'required' => true
        ],
        'feed_type' => [
            'valid' => ['string'],
            'required' => true
        ]
    ]
]

To:

'GetItemFeed' => [
    'method' => 'GET',
    'resource' => 'item',
    'responseClass' => '\DTS\eBaySDK\Feed\Types\GetItemFeedRestResponse',
    'params' => [
        'category_id' => [
            'valid' => ['string'],
            'required' => true
        ],
        'date' => [
            'valid' => ['string'],
            'required' => true
        ],
        'feed_type' => [
            'valid' => ['string'],
            'required' => true
        ]
    ]
]

But got this:

object(DTS\eBaySDK\Feed\Types\GetItemFeedRestResponse)#2566 (5) {
["values":"DTS\eBaySDK\Types\BaseType":private]=>
array(1) {
    ["errors"]=>
    object(DTS\eBaySDK\Types\RepeatableType)#2547 (5) {
    ["data":"DTS\eBaySDK\Types\RepeatableType":private]=>
    array(1) {
        [0]=>
        object(DTS\eBaySDK\Feed\Types\ErrorDetailV3)#2558 (2) {
        ["values":"DTS\eBaySDK\Types\BaseType":private]=>
        array(4) {
            ["errorId"]=>
            int(13015)
            ["domain"]=>
            string(10) "API_BROWSE"
            ["category"]=>
            string(7) "REQUEST"
            ["message"]=>
            string(109) "The mandatory 'Range' request header is missing. For help, see the API Reference documentation for this call."
        }
        ["attachment":"DTS\eBaySDK\Types\BaseType":private]=>
        array(2) {
            ["data"]=>
            NULL
            ["mimeType"]=>
            NULL
        }
        }
    }
    ["position":"DTS\eBaySDK\Types\RepeatableType":private]=>
    int(0)
    ["class":"DTS\eBaySDK\Types\RepeatableType":private]=>
    string(46) "DTS\eBaySDK\Feed\Types\GetItemFeedRestResponse"
    ["property":"DTS\eBaySDK\Types\RepeatableType":private]=>
    string(6) "errors"
    ["expectedType":"DTS\eBaySDK\Types\RepeatableType":private]=>
    string(36) "DTS\eBaySDK\Feed\Types\ErrorDetailV3"
    }
  }
  ...
}

I know this API is in beta, but is there a way to work on it using the SDK? Or at least a stable endpoint or a way to update the SDK code in a secure way for upcoming SDK official updates?

SDK Version: 14.0