GET /api/campaign.php
This endpoint can be used to list campaigns of an organization. Status and tag-based filters can be applied to return specific campaigns.
Request parameters
| Parameter | Value |
| status | Filter records by status. Possible values are - DRAFT, PENDING, COMPLETED, CANCELLED. In order to apply multiple status filters, include the parameter in query arguments as status[]=DRAFT&status[]=PENDING. |
| tags | Filter records by tags. In order to apply multiple tag filters, include the parameter in query arguments as tags[]=Tag1&tags[]=Tag2. |
| sort_by | Sort records by field. Only the value of created_at is supported. Default: created_at |
| sort_order | Sort direction. Possible values are ASC and DESC.Default: ASC |
| limit | Number of records to return per request. If this parameter is not provided or has a value of 0, then limit is not applied and all records are returned. |
| page | Page number. Value of 0 returns records from 0 to 10 000, 1 returns records from 10 001 to 20 000, etc. Default: 0 |
Response parameters
Response is a JSON list of JSON objects.
| Parameter | Value |
| id | Unique ID of the campaign. Numeric. |
| name | Campaign name and message subject. |
| template | Object of template used in the campaign.Note! For deleted templates the value of “DELETED” is returned.Read the "Template object parameters" section for more information. |
| tags | List of campaign tags. |
| created_at | Campaign creation date. Formatted as YYYY-MM-DD HH:MM:SS, and presented in Europe/Tallinn timezone. |
| completed_at | Campaign completion date. Parameter has value only when the campaign's status is COMPLETED. Formatted as YYYY-MM-DD HH:MM:SS, and presented in Europe/Tallinn timezone. |
| status | Campaign status. Possible values: DRAFT, PENDING - sending still in progress, COMPLETED, CANCELLED. |
Template object parameters
Note! For deleted templates the value of “DELETED” is returned.
| Parameter | Value |
| id | Template ID. Numeric |
| name | Template name. |
| preview_url | URL to template preview. |
Example
$ curl -X GET -u "${USERNAME}:${PASSWORD}" \
"https://${SUBDOMAIN}.sendsmaily.net/api/campaign.php"
(JavaScript/JSON)
[
{
"id": 1,
"name": "My first campaign",
"template": {
"id": 19,
"name": "Old template",
"preview_url": "https://<subdomain>.sendsmaily.net/template/preview/id/19"
},
"tags": ["Men"],
"created_at": "2021-01-21 10:00:00",
"completed_at": "2021-01-21 10:05:00",
"status": "COMPLETED"
},
{
"id": 3,
"name": "Offer you cannot refuse",
"template": “DELETED”,
"tags": ["Women"],
"created_at": "2021-01-21 10:00:00",
"completed_at": null,
"status": "PENDING"
}
]