GreenArrow Documentation

Delete Campaigns API

Enabling the API

This API is disabled by default and is available only for on-premises customers.

Enable this API by running this command as root from the command line on your GreenArrow server:

echo "UPDATE s_system_configs SET enable_api_delete_campaigns = 'true'" | /var/hvmail/postgres/default/bin/psql -U greenarrow greenarrow

Deleting Campaigns

DELETE /ga/api/v2/campaigns/{campaign_id}

The campaign and associated records will be removed from the database when the response is returned. The only remaining record will be a stub containing the campaign’s name, allowing old references to it to show “Campaign Name (deleted)” in the user interface.

The campaign may not be deleted if it is “in use”. A campaign is “in use” if:

  • It is referenced by a named segment
  • It is referenced by the ad-hoc segment of a campaign that has not yet been cancelled or finished sending
  • It is referenced by the ad-hoc segment of an autoresponder
  • It is referenced by the ad-hoc segment of a subscriber export that has not yet been cancelled or completed

A deleted campaign may be referenced by (and thus visible by looking at):

  • The ad-hoc segment of a completed or canceled campaign that used it
  • The ad-hoc segment of a completed or canceled subscriber export that used it

The organization is not updated to remove the deleted campaign’s statistics. Even though the campaign has been deleted, its impact on the organization’s stats remains.

Response

campaign
hash
id
integer
The primary key of the deleted campaign.
name
string
The name of the deleted campaign.

Example

> DELETE /ga/api/v2/campaigns/4 HTTP/1.1
> Authorization: Basic MToxNmRjYjllYmM1MzE1M2Q3YWViOTQ3YmE0MGE3NDVkMzc4N2ViYWJj
> Accept: application/json
> Content-Type: application/json

< Content-Type: application/json; charset=utf-8

{
  "success": true,
  "data": {
    "campaign": {
      "id": 4,
      "name": "Daily News"
    }
  },
  "error_code": null,
  "error_message": null
}