Error code 422 Unprocessable Entity

CoppoG
Tourist
10 1 2

Hi to all,

i've a little random problems when i try to create product's new variants:

1° example (result OK 201 Created)

..myshopify.com/admin/api/2020-07/products/4683504517206/variants.json

POST {"variant":{"product_id":4683504517206,"title":"XL/OUTLAW ORANGE","price":"3099.00","sku":"TR-01.20.10.3916","inventory_policy":"deny","inventory_management":"shopify","option1":"XL","option2":"OUTLAW ORANGE"}}

2° example (result KO 422 Unprocessable Entity)

..myshopify.com/admin/api/2020-07/products/4683902943318/variants.json

POST {"variant":{"product_id":4683902943318,"title":"S/PINOT NOIR RED","price":"2099.00","sku":"TR-01.20.10.4210","inventory_policy":"deny","inventory_management":"shopify","option1":"S","option2":"PINOT NOIR RED"}}

Both requests are similar (on 2 different product) but in example 1 i've response OK and in example 2 not!

i've thinked title field (contains "/" character) or sku field (contains "-" and "." characters) but in both examples is there

Any idea?

0 Likes
Greg_Kujawa
Shopify Partner
965 80 204

And in your second call example that fails, have you verified the product ID is valid?

0 Likes
CoppoG
Tourist
10 1 2

yes, in second call, product'id is valid..

0 Likes
Greg_Kujawa
Shopify Partner
965 80 204

Okay, let's narrow other elements down to deduce things. What about changing the second API call so that the Title is generic, say, "GENERIC TITLE" If that still fails, change the API call so that the SKU is generic, say, "GENERICSKU" and see how that goes. All based off your confirmation that the product ID is valid.

0 Likes