question

levon avatar image
levon asked levon answered

Help me please to add category for item

I want to add category for each item using this POST /v3/merchants/{mId}/category_items I send this request {"elements":[{"item":{"id":"QG7NA088Q1JZ2"},"category":{"id":"JFCKWK5PHF7CM"}}]} or this {"item":{"id":"DWHEN36A03F5J"},"category":{"id":"JFCKWK5PHF7CM"}}

there are not working help me please to understand request syntax . or if you have code example answer this post and send me the code example please . thanks

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Mike M avatar image
Mike M answered

{"elements":[{"item":{"id":"QG7NA088Q1JZ2"},"category":{"id":"JFCKWK5PHF7CM"}}]} is the correct syntax for associating an item to a category. What response code are you receiving? The response body will be empty.

Have you double-checked your item to see if it is properly associated with the category? You will need to add a categories field expansion to the API request in order to retrieve that additional data in order to verify. /v3/merchants/{mId}/items/{itemId}?expand=categories

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

levon avatar image
levon answered

yes I use this code {"elements":[{"item":{"id":"QG7NA088Q1JZ2"},"category":{"id":"JFCKWK5PHF7CM"}}]} after check with this /v3/merchants/{mId}/items/{itemId}?expand=categories and don't see results in item categories . do you have code example.thanks

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community