open-api icon indicating copy to clipboard operation
open-api copied to clipboard

[BUG]: Updating digital listings results in Server Error if body does not include type => 'download'

Open nmrdxt opened this issue 2 years ago • 3 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

It looks like specifying the listing type during updateListing is required for digital listings, but not for physical. Moreover, the error returned appear to be a 500 error and not 400 error.

Steps to reproduce

updateListing a digital listing with a body that does not include the type of the product.

Expected behavior

I believe the updateListing body should inherit the current type of the listing, if the 'type' property is missing.

Additional context

No response

nmrdxt avatar Apr 30 '22 18:04 nmrdxt

@nmrdxt Can you provide some example listing ids? I'm not able to duplicate this behavior.

etsyachristensen avatar May 02 '22 17:05 etsyachristensen

Hi @etsyachristensen,

I ran into the same exact issue. I am trying to update the quantity of a digital listing and until I set the 'type' property to 'download', I get a 500 server error. Once I set it, it SEEMS to update, however, the listing on etsy.com does not reflect the new quantity even though an API call to the listing WILL reflect the new quantity. There is definitely something going on with updating digital listings in V3.

Here is my example to replicate. This is for listing number 920871887.

$url = 'https://openapi.etsy.com/v3/application/shops/.' $shopID . '/listings/' . $listingID;
  
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_ENCODING, '');
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_TIMEOUT, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'quantity=500&type=download');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_HEADER, true);
  
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
      'Content-Type: application/x-www-form-urlencoded; charset=utf-8',
      'x-api-key: ' . $api_key,
      'Authorization: Bearer ' . $token
    ));  
    
$response = curl_exec($ch);
var_dump($response);

After I execute the code above , I get a "HTTP/1.1 200 OK" response (only after I added the type=download parameter) along with the listing information. When I make a subsequent call to the API (you can do this in the browser for listing 920871887)

https://openapi.etsy.com/v3/application/listings/batch?client_id=[your API key here]&listing_ids=920871887

you'll see that the quantity is 500, yet when I check the listing itself and try and edit it manually (the only way I can see the quantity), it says 27. Can you please take a look?

Allen209 avatar May 09 '22 15:05 Allen209

@Allen209 I will see if I can duplicate this, but I can tell you that you should NOT use updateListing to change the quantity or price. You need to use the updateListingInventory endpoint. This will be enforced starting June 6th anyway.

etsyachristensen avatar May 09 '22 16:05 etsyachristensen