ricbra / php-discogs-api

PHP 5.4 Implementation of the Discogs API
MIT License
152 stars 95 forks source link

editListing throws GuzzleHttp\Exception\ParseException #39

Closed marcelkussin closed 5 years ago

marcelkussin commented 8 years ago

When i call this Method i get:

GuzzleHttp\Exception\ParseException Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON

marcelkussin commented 8 years ago

i forgot:

i added

'editListing' => [ 'httpMethod' => 'POST', 'uri' => '/marketplace/listings/{listing_id}', 'summary' => 'Edits a Marketplace listing.', 'responseModel' => 'GetResponse', 'parameters' => [ 'listing_id' => [ 'type' => 'string', 'location' => 'uri', 'required' => true ], 'release_id' => [ 'type' => 'string', 'location' => 'json', 'required' => true ], 'condition' => [ 'type' => 'string', 'location' => 'json', 'required' => true, ], 'sleeve_condition' => [ 'type' => 'string', 'location' => 'json', 'required' => false, ], 'price' => [ 'type' => 'number', 'location' => 'json', 'required' => true, ], 'comments' => [ 'type' => 'string', 'location' => 'json', 'required' => false, ], 'allow_offers' => [ 'type' => 'boolean', 'location' => 'json', 'required' => false, ], 'status' => [ 'type' => 'string', 'location' => 'json', 'required' => false, ], 'external_id' => [ 'type' => 'string', 'location' => 'json', 'required' => false, ], 'location' => [ 'type' => 'string', 'location' => 'json', 'required' => false, ], 'weight' => [ 'type' => 'number', 'location' => 'json', 'required' => false, ], 'format_quantity' => [ 'type' => 'number', 'location' => 'json', 'required' => false, ] ] ],

to the service.php

ricbra commented 8 years ago

Could you open a merge request with these additions in it so I can take a look?

Did you try to debug the call? I have no clue whats wrong without more details.

marcelkussin commented 8 years ago

sorry i did not, i will try to open a merge request. never did that before.

ricbra commented 8 years ago

I tried your PR, but I'm not able to create a new listing (UNPROCESSABLE ENTITY error) so editing is also difficult.

Could you debug and check what response you receive? dump the json?

marcelkussin commented 8 years ago

how can i debug the Response? I get an GuzzleHttp\Exception\ParseException i could dump the Exception-Response if you like

ricbra commented 8 years ago

Try to find out where the exception is being thrown and start debugging from there I suppose. Debug the var Guzzle is trying to parse and there you should find some more information.

marcelkussin commented 8 years ago

now i get

"Error executing command: cURL error 7: Failed to connect to api.discogs.com port 443: Connection timed out" and can't debug anything. Thats very wired, because no settings on the live-server have been changed since last time.

simonrl commented 4 years ago

I had the same problem; can I PR a fix? I think the problem is that editListing shouldn't expect a JSON GetResponse, because the Discogs API returns NULL, which is not valid JSON and throws above exception.