Delete a product image
This endpoint will let you delete extra images an existing product in your catalog has. This does not let you delete the default image of the product which is a mandatory field that can't be deleted.
To use this API, you must connect a number that uses the free version of WhatsApp Business. This API does not need a WhatsApp Business API account to work.
You will need the product IDs of these products to make modifications to your catalog.
Just like with the app, each modification you make will go through a verification process made by WhatsApp that can take between a few minutes to a few hours.
Invocation
Make a DELETE
request to https://api.p.2chat.io/open/whatsapp/catalog/product/image/<product-id>/<image-index>
, where:
product-id
: is the product ID of which you want to delete the images.image-index
: is the index of the image you want to delete. All indices start at 0. For example, if you have 3 additional images apart from the default image that is mandatory, you will have indeces0
,1
, and2
. If you want to delete the second image, you will have to use the index1
as the parameter.
Request body
For each request, you must specify the phone number you connected to 2Chat that you want to use as the client.
{
"from_number": "+595981461442"
}
In the following examples, we are using 6489529801134316
as the product ID and index 2
to delete the second image.
- cURL
- Python
- NodeJS
curl --location --request DELETE 'https://api.p.2chat.io/open/whatsapp/catalog/product/image/6489529801134316/2' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"from_number": "+595981461442"
}'
import requests
url = "https://api.p.2chat.io/open/whatsapp/catalog/product/image/6489529801134316/2"
payload = json.dumps({
"from_number": "+595981461442"
})
headers = {
'X-User-API-Key': 'your_api_key_here'
}
response = requests.request("DELETE", url, headers=headers, data=payload)
print(response.text)
var axios = require('axios');
let data = JSON.stringify({
"from_number": "+595981461442"
});
var config = {
method: 'DELETE',
url: 'https://api.p.2chat.io/open/whatsapp/catalog/product/image/6489529801134316/2',
headers: {
'X-User-API-Key': 'your_api_key_here'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Response
{
"success": true
}