400 error on v3 updateListingInventory endpoint

538 views
Skip to first unread message

Mikel Rodriguez

unread,
Jul 22, 2021, 2:28:24 PM7/22/21
to Etsy API
Hi, I'm trying to update my inventory using the updateListingInventory endpoint on etsy's v3 api and I keep on getting the following same error.
I have a Listing with multiple offerings, and I want to update the specific quantity of each offer for a listing.

Could anyone please let me know where I'm going wrong with this api call?
I'm trying to update the quantities of specific products/offerings in the inventory. Yet, I keep on receiving this error:

(400): {"error":"Missing input parameter: [products]"}

I've been trying to solve it for a while, but no luck yet.

As you can see my request contains the products field:

PUT Request: https://openapi.etsy.com/v3/application/listings/562319214/inventory; '{"products":[{"sku":"CIO-1001-B-S","offerings":[{"quantity":"109","is_enabled":true}]}]}'

Currently I'm using content-type: application/x-www-form-urlencoded
But I also tried with content-type: application/json (as in their documentation) and the error was the following:

Response (400): {"error":"Cannot load body of that type"}

This is my code:

$list_id = trim($conv->custom_field_1);

$put = [
    'products' => [[
         'sku' => $conv->sku,
          'offerings' => [[
                   'quantity' => $quantity,
                    'is_enabled' => true
            ]]
     ]],
      //Are these two needed?? What are they??
   //'quantity_on_property' => $quantity,
   //'sku_on_property' => $conv->sku,
];

try {
$result = $this->curl->put('/v3/application/listings/'.$list_id.'/inventory', [], $put);
} catch(...){...}

Any advice is appreciate it,
Thanks,

Mikel Rodriguez

unread,
Aug 2, 2021, 10:35:10 AM8/2/21
to Etsy API
And here it is a bit more information. Now I'm adding the full object on the query as per the documentation:

This is how I create the body of my put request:

1. I use the getListingInventory endpoint with the query parameter includes: "Listing". And this is the response:

{"products":[{"product_id":2145943226,"sku":"CIO-1002","is_deleted":false,"offerings":[{"offering_id":2001427797,"quantity":994,"is_enabled":true,"is_deleted":false,"price":{"amount":66,"divisor":100,"currency_code":"USD"}}],"property_values":[{"property_id":200,"property_name":"Primary color","scale_id":null,"scale_name":null,"value_ids":[1],"values":["Black"]}]}],"price_on_property":[200],"quantity_on_property":[200],"sku_on_property":[200],"listing":{"listing_id":576120207,"user_id":117697394,"shop_id":16552740,"title":"CIO-1002","description":"CIO-1002 test product 1","state":"active","creation_timestamp":1627068991,"ending_timestamp":1637699791,"original_creation_timestamp":1512000711,"last_modified_timestamp":1627068991,"state_timestamp":1527712231,"quantity":994,"shop_section_id":null,"featured_rank":-1,"url":"https:\/\/www.etsy.com\/listing\/576120207\/cio-1002","num_favorers":0,"non_taxable":false,"is_customizable":false,"listing_type":0,"tags":[],"materials":[],"shipping_profile_id":52997705509,"processing_min":1,"processing_max":3,"who_made":"i_did","when_made":"2010_2019","is_supply":false,"item_weight":null,"item_weight_unit":null,"item_length":null,"item_width":null,"item_height":null,"item_dimensions_unit":null,"is_private":false,"recipient":null,"occasion":null,"style":[],"file_data":"","has_variations":true,"should_auto_renew":false,"language":"en-US","price":{"amount":66,"divisor":100,"currency_code":"USD"},"taxonomy_id":825}}

2. From that response I create the body of my endpoint updateListingInventory:

PUT Request: https://openapi.etsy.com/v3/application/listings/576120207/inventory; '{"products":[{"sku":"CIO-1002","property_values":[{"property_id":200,"value_ids":[1],"scale_id":0,"property_name":"Primary color","values":["Black"]}],"offerings":[{"price":0.66,"quantity":83,"is_enabled":true}]}],"price_on_property":[200],"quantity_on_property":[200],"sku_on_property":[200]}

3. I use this header:
$header = [
'Content-Type: application/json',
'x-api-key: '.Etsy::$consumer_key,
'Authorization: Bearer '.$this->access_token,
];
But I keep on getting the 400 error with message "cannot load body of that type"

Could anyone advise how to fix this issue?
Also, is it necessary to include the fields "price_on_property":[200],"quantity_on_property":[200],"sku_on_property":[200]? Following the documentation they seem optional, but there's this warning message that I'm not sure what it refers to:

"Updates the inventory for a listing identified by a listing ID. The update fails if the supplied values for product sku, offering quantity, and/or price are incompatible with values in *_on_property_* fields. When setting a price, assign a float equal to amount divided by divisor as specified in the Money resource".

Also, I tried getting the property_id from the endpoint getListingProperties, but that property_id (which was different) didn't seem to work either.

Thank you for your support,

Mikel Rodriguez

Esat Yılmaz

unread,
Jul 5, 2022, 8:01:12 AM7/5/22
to Etsy API
Hi did yo solve it?

2 Ağustos 2021 Pazartesi tarihinde saat 17:35:10 UTC+3 itibarıyla Mikel Rodriguez şunları yazdı:

Daniel Wiedenheft

unread,
Aug 5, 2022, 8:15:40 AM8/5/22
to Etsy API
I'm having the same problem, but in Python.  With the exception of substituting my IDs and prices, I've made the request identical to the example in the documentation at https://www.etsy.com/developers/documentation/getting_started/oauth#section_authorized_put_post_requests (though I'm using OpenAPI v3 and there doesn't seem to be any documentation for v3 on this subject)  and I keep getting "Missing input parameter [products]".  Has anyone had any luck solving this?
Thanks,
-Dan W
Reply all
Reply to author
Forward
0 new messages