Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

Finding API examples crash #8

Closed
nostah opened this issue Mar 23, 2015 · 12 comments
Closed

Finding API examples crash #8

nostah opened this issue Mar 23, 2015 · 12 comments

Comments

@nostah
Copy link

nostah commented Mar 23, 2015

Hello!

I've tried some examples from Finding API and they all crash with following error:

PHP Fatal error:  Uncaught exception 'Guzzle\Http\Exception\ServerErrorResponseException' with message 'Server error response
[status code] 500
[reason phrase] Internal Server Error
[url] http://svcs.ebay.com/services/search/FindingService/v1' in /Users/dev/ebay/test3/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php:43
Stack trace:
#0 /Users/dev/ebay/test3/vendor/guzzle/guzzle/src/Guzzle/Http/Message/Request.php(145): Guzzle\Http\Exception\BadResponseException::factory(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Message\Response))
#1 [internal function]: Guzzle\Http\Message\Request::onRequestError(Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2 /Users/dev/ebay/test3/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(164): call_user_func(Array, Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatche in /Users/dev/ebay/test3/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php on line 43

any idea what could be wrong?

@davidtsadler
Copy link
Owner

Have you entered your production and sandbox application keys in the file configuration.php? This error normally comes up if they have been missed.

@nostah
Copy link
Author

nostah commented Mar 23, 2015

I skipped the config file and used production keys directly:

    $service = new FindingService([
        'appId'      => '<my_production_key_here>',
        'apiVersion' => 907,
        'globalId'   => GlobalIds::US,
    ]);

    $request = new FindItemsByKeywordsRequest();
    $request->keywords = 'Harry Potter';
    $response = $service->findItemsByKeywords($request);
    print_r($response);

@davidtsadler
Copy link
Owner

Strange. There is nothing wrong with your code so I would recommend that you double check the appId key.

  • Ensure that you are using the production app id and not the sandbox by mistake.
  • Ensure that you have copied all of the app id. Missing one or more characters from either the start or end would be enough to trigger the error.
  • Check that you haven't added any extra characters such as spaces or newline to the string. I've had instances in the past when copying text from a file resulted in an newline character been injected at the end. In addition it's easy inadvertently add spaces between the quote marks E.g ' a string ' should be 'a string'

@davidtsadler
Copy link
Owner

I've just spotted that you are not specifying the correct apiVersion. You have used the Trading version by mistake. For the Finding service the latest version is '1.13.0'.

'apiVersion' => '1.13.0'

Double check both your app id and the version number as it looks like the error can be caused if either are wrong.

@nostah
Copy link
Author

nostah commented Mar 23, 2015

yep! that helped. thanks a lot. it wasn't clear to me and I've used ebay api version number... now it works :)

@davidtsadler
Copy link
Owner

The issue has a given me an idea :) I'm wondering if the SDK should automatically use the latest API version as a default value. That way users of the SDK wouldn't have to specify it in the code unless they wanted to override the default. I'll look at adding this in a future release.

@jamesmorris7
Copy link

jamesmorris7 commented Aug 18, 2016

Same Guzzler error
'( ! ) Fatal error: Uncaught exception 'Guzzle\Http\Exception\ServerErrorResponseException' with message ' in C:\wamp64\www\sites\EbaySDK\OldSDK\ebay-sdk-examples-all\vendor\guzzle\guzzle\src\Guzzle\Http\Exception\BadResponseException.php on line 43
( ! ) Guzzle\Http\Exception\ServerErrorResponseException: Server error response [status code] 500 [reason phrase] Internal Server Error [url] http://svcs.ebay.com/services/search/FindingService/v1 in C:\wamp64\www\sites\EbaySDK\OldSDK\ebay-sdk-examples-all\vendor\guzzle\guzzle\src\Guzzle\Http\Exception\BadResponseException.php on line 43'

Not sure what is different in these 2 examples

FindItemsForFavoriteSearch - DOES NOT WORK - GUZZLER ERROR
//=================================================//

require __DIR__.'/../vendor/autoload.php';
$config = require __DIR__.'/../configuration.php';

//The namespaces provided by the SDK
 use \DTS\eBaySDK\Constants; //tested - is needed
 use \DTS\eBaySDK\Finding\Services;
 use \DTS\eBaySDK\Finding\Types;
  //use \DTS\eBaySDK\Finding\Enums;  // not needed

$service = new Services\FindingService(array(
    'appId' => $config['production']['appId'],
    'apiVersion' => $config['findingApiVersion'],
    'globalId' => Constants\GlobalIds::US
));

//Ask for it
$request = new Types\FindItemsForFavoriteSearchRequest();
//Limit it
$request->paginationInput = new Types\PaginationInput();
$request->paginationInput->entriesPerPage = 10;
//Return it
$response = $service->findItemsForFavoriteSearch($request);

Simple-keywords-search.php - DOES WORK
//=========================================//

 require __DIR__.'/../vendor/autoload.php';
 $config = require __DIR__.'/../configuration.php';

//The namespaces provided by the SDK
use \DTS\eBaySDK\Constants;   //tested - is needed
use \DTS\eBaySDK\Finding\Services;
use \DTS\eBaySDK\Finding\Types;


$service = new Services\FindingService(array(
    'appId' => $config['production']['appId'],
    'apiVersion' => $config['findingApiVersion'],
    'globalId' => Constants\GlobalIds::US
));

$request = new Types\FindItemsByKeywordsRequest();
$response = $service->findItemsByKeywords($request);

@davidtsadler
Copy link
Owner

It may be that the findItemsForFavoriteSearch operation is no longer supported by the Finding API. I'll need to double check because if that is the case then it also needs to be removed from the SDK.

@jamesmorris7
Copy link

... don't worry about that if you have deprecated it... I have posted in
Google forum that even though I have replaced both new SDK folders and
changed all of my keys... It's still will not connect... If I can get your
assistance on that, I'm sure the new stuffed would probably work... No
sense in you having to go backwards

On Aug 18, 2016 12:19 PM, "David Terence Sadler" notifications@github.com
wrote:

It may be that the findItemsForFavoriteSearch operation is no longer
supported by the Finding API. I'll need to double check because if that is
the case then it also needs to be removed from the SDK.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#8 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALOmSf_779YnsqiNTxxrKbgYdErZo8fbks5qhIYCgaJpZM4DzA3L
.

@MotorSportTeam
Copy link

What is authToken?

@delphiy
Copy link

delphiy commented Aug 26, 2017

Any idea how to get sold count after searching by keyword

Thanks

@sararabie
Copy link

i have this exception and i try use

$service = new Services\FindingService([
'credentials' => $this->config['production']['credentials'],
'apiVersion' => '1.13.0',
'globalId' => Constants\GlobalIds::US
]);
but the exception still found
Server error: POST https://svcs.ebay.com/services/search/FindingService/v1 resulted in a 500 Internal Server Error response:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants