Error code 422 Unprocessable Entity

CoppoG
Tourist
12 1 5

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?

Replies 3 (3)
Gregarican
Shopify Partner
1030 86 276

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

CoppoG
Tourist
12 1 5

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

Gregarican
Shopify Partner
1030 86 276

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.