Deleting a campaign
Contents
- Overview
- Version-specific information
- Permissions and authentication
- HTTP parameters
- Headers
- Sample request
- Sample response
- Possible error responses
Overview
| Property | Value |
|---|---|
| Call name | delete-campaign |
| Endpoint URL | https://{API hostname}/internal/delete-campaign |
| Request methods | DELETE |
| Request Content-Type | application/json, application/x-www-form-urlencoded |
| Response Content-Type | application/json |
| Auth required | yes |
The delete-campaign endpoint deletes an existing campaign. When a campaign is deleted, any webhooks associated with the campaign are also deleted. The campaign is set to inactive and marked as deleted.
Version-specific information
There is currently no version-specific information for this endpoint.
Permissions and authentication
The performing user needs to be logged in and have write access to the entity (business or chain) to which the campaign is connected. The user must have permissions_business_chain_campaign set to true in the permissions table.
If the chain has restrict_campaign_enable set to true, deleting a campaign that is currently active additionally requires the campaign_enable permission (or super user access). Inactive campaigns can be deleted without the campaign_enable permission.
HTTP parameters
The following HTTP parameters can be passed to the API:
| Parameter | Description |
|---|---|
| campaign_id | (integer, mandatory) The ID of the campaign to delete. |
Headers
The following headers can/must be passed to the API call:
| Parameter | Description |
|---|---|
| N/A | N/A |
Sample request
curl -X DELETE https://{API hostname}/internal/delete-campaign \
-H "X-Spaaza-Session-User-Id: 1548854" \
-H "X-Spaaza-Session-Key: 564e5b4faa7f639dacf1983f1dae62155d5734b789b06b5986c43bfe2542854e" \
-H "Content-Type: application/json" \
-d '{
"campaign_id": 1234
}'
Sample response
Returns an OK code and a JSON representation confirming the deletion:
{
"result": {
"code": 1,
"status": "ok"
},
"results": {
"campaign_id": 1234,
"is_active": false,
"is_deleted": true,
"result_type": "delete-campaign"
}
}
Possible error responses
The following represents a list of possible error responses for the delete-campaign endpoint:
| Code | Name and Description | HTTP Status Code |
|---|---|---|
| 6 | no_valid_session The user needs to be logged in and a valid session key needs to be sent | 401 |
| 68 | permission_denied_or_non_existent This user has insufficient permissions for this object or the object does not exist. | 403 |
| 244 | campaign_id_invalid The campaign_id passed must be an integer | 400 |
| 245 | campaign_id_not_present The campaign_id must be passed as a parameter | 400 |
| 246 | campaign_id_not_found The campaign_id supplied could not be found. | 404 |