question

ferrettinico avatar image
ferrettinico asked yogeshm commented

How do I associate a Product with a Category with the REST API

According to the documentation:

POST /v3/merchants/{mId}/category_items --- Create or delete an item/category association

But the parameter is just an "item" (expandable) how can I associate it to a specific category?

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.

1 Answer

Jacob Abrams avatar image
Jacob Abrams answered yogeshm commented

The docs for that endpoint isn't very useful. That endpoint accepts a JSON list of category-item id pairs like so:

{
    "elements": [
        {
            "item" : { "id" : "1234123412341" },
            "category" : { "id" : "ABCABCABCABCA" }
        },
        {
            "item" : { "id" : "4564564564564" },
            "category" : { "id" : "DEFDEFDEFDEFD" }
        }
    ]
}
3 comments
10 |2000

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

ferrettinico avatar image ferrettinico commented ·

Worked great! Thank you very much!

0 Likes 0 ·
Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Don't forget to mark the question answered by clicking the checkmark button on the right side of the answer, that we know this question can be closed.

0 Likes 0 ·
yogeshm avatar image yogeshm commented ·

hi have send data from rest api like { "item":{"id":"83XZ5VZQCESXW"}, "category":{"id":"HGTYMCBEMYTDJ"} } api.clover.com:443/v3/merchants/*****/categories/HGTYMCBEMYTDJ?expand=items and i get response body { "id": "HGTYMCBEMYTDJ", "name": "yog", "items": { "elements": [] } }

help to add product category in product via rest api please guide for which json data required and which api to i send Thanks

0 Likes 0 ·

Welcome to the
Clover Developer Community