0
votes

I'm trying to use the connect api to create new products. I keep getting the following error.

{ type: 'unprocessable_entity', message: 'Item[name]:name required, max length 255, min length 1; Item[variations]:Must have at least one variation' }

The object I'm passing does have an name and a variation.

{"variations":[{"price_money":{"currency_code":"USD","amount":500},"name":"Small","sku":"TST101"}],"name":"My Test","description":"This is a desc"}

I'm unsure of why this is failing, any help would be great.

1

1 Answers

0
votes

I believe this error is occurring because your request does not include a Content-Type: application/json header. I attempted to create an item with the JSON body you list above, and the request succeeded. I then removed the Content-Type: application/json header from my request, and it failed with the same error you encountered.

This is clearly not a helpful error message, given the actual cause. I will work with the Connect API engineering team to improve it.