Skip to main content

Add Products to Collection

Method#

/catalogs/collection/add-product#

POST https://api.z-api.io/instances/{{instanceId}}/token/{{instanceToken}}/catalogs/collection/add-product

Header#

KeyValue
Client-TokenACCOUNT SECURITY TOKEN

Concept#

Using this method, you will be able to add products to a collection in your catalog.

Attention

When adding or removing products from a collection, the ID of the collection is changed by WhatsApp. This means that when you register a product in the collection and try to perform any other operation using the "old" ID, it will result in a non-functional route. Remember to use the ID returned by this route, which is already updated for subsequent operations.


Attributes#

Required#

AttributesTypeDescription
collectionIdstringCollection ID
productIdsarray stringIDs of the products to be part of the collection

Request Body#

{
"collectionId": "658387616418640",
"productIds": ["6643149779134830", "6988917394481455"]
}

Response#

200#

AttributesTypeDescription
successbooleantrue if it was successful, false in case of failure
collectionIdstringUpdated ID of the collection

Example

{
"success": true,
"collectionId": "1798362193933497"
}

405#

In this case, ensure that you are sending the method specification correctly, i.e., check if you sent the POST or GET as specified at the beginning of this topic.

415#

If you receive a 415 error, make sure to add the "Content-Type" of the object you are sending in the request headers; in most cases, it should be "application/json".


Code#