Campaign¶
Contents
Summary¶
Resource |
Operation |
Description |
---|---|---|
Campaign |
Creates a new campaign. |
|
Gets a single campaign given its ID. |
||
Gets a list of all the campaigns. |
||
Updates an existing campaign. |
||
Deletes a campaign. |
Create¶
JSON Schema
Required parameters are in bold.
type |
object |
||
properties |
|||
|
type |
string |
|
maxLength |
255 |
||
minLength |
1 |
||
|
type |
array |
|
items |
|||
type |
string |
||
maxLength |
255 |
||
minLength |
1 |
||
minItems |
1 |
||
additionalProperties |
False |
-
POST
/api/campaigns
¶ Creates a new campaign.
Example request:
POST /campaigns HTTP/1.1 Host: 127.0.0.1 Content-Type: application/json { "name": "LOLcats", "aliases": ["icanhaz"] }
Example response:
HTTP/1.1 201 Created Content-Type: application/json { "id": 1, "aliases": ["icanhaz"], "created_time": "Thu, 28 Feb 2019 17:10:44 GMT", "modified_time": "Thu, 28 Feb 2019 17:10:44 GMT", "name": "LOLcats" }
- Request Headers
Authorization – Optional Apikey value
- Response Headers
Content-Type – application/json
- Status Codes
201 Created – Campaign created
400 Bad Request – JSON does not match the schema
401 Unauthorized – Invalid role to perform this action
404 Not Found – Campaign alias not found
409 Conflict – Campaign already exists
Read Single¶
-
GET
/api/campaigns/
(int: campaign_id)¶ Gets a single campaign given its ID.
Example request:
GET /campaigns/1 HTTP/1.1 Host: 127.0.0.1 Accept: application/json
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "id": 1, "aliases": ["icanhaz"], "created_time": "Thu, 28 Feb 2019 17:10:44 GMT", "modified_time": "Thu, 28 Feb 2019 17:10:44 GMT", "name": "LOLcats" }
- Request Headers
Authorization – Optional Apikey value
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – Campaign found
401 Unauthorized – Invalid role to perform this action
404 Not Found – Campaign ID not found
Read Multiple¶
-
GET
/api/campaigns
¶ Gets a list of all the campaigns.
Example request:
GET /campaigns HTTP/1.1 Host: 127.0.0.1 Accept: application/json
Example response:
HTTP/1.1 200 OK Content-Type: application/json [ { "id": 1, "aliases": ["icanhaz"], "created_time": "Thu, 28 Feb 2019 17:10:44 GMT", "modified_time": "Thu, 28 Feb 2019 17:10:44 GMT", "name": "LOLcats" }, { "id": 2, "aliases": [], "created_time": "Thu, 28 Feb 2019 17:11:37 GMT", "modified_time": "Thu, 28 Feb 2019 17:11:37 GMT", "name": "Derpsters" } ]
- Request Headers
Authorization – Optional Apikey value
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – Campaigns found
401 Unauthorized – Invalid role to perform this action
Update¶
JSON Schema
Required parameters are in bold.
type |
object |
|
properties |
||
|
type |
string |
maxLength |
255 |
|
minLength |
1 |
|
additionalProperties |
False |
-
PUT
/api/campaigns/
(int: campaign_id)¶ Updates an existing campaign.
Example request:
PUT /campaigns/1 HTTP/1.1 Host: 127.0.0.1 Content-Type: application/json { "name": "Derpsters", }
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "id": 1, "aliases": ["icanhaz"], "created_time": "Thu, 28 Feb 2019 17:10:44 GMT", "modified_time": "Thu, 28 Feb 2019 17:18:29 GMT", "name": "Derpsters" }
- Request Headers
Authorization – Optional Apikey value
- Response Headers
Content-Type – application/json
- Status Codes
200 OK – Campaign updated
400 Bad Request – JSON does not match the schema
401 Unauthorized – Invalid role to perform this action
404 Not Found – Campaign ID not found
409 Conflict – Campaign already exists
Delete¶
-
DELETE
/api/campaigns/
(int: campaign_id)¶ Deletes a campaign.
Example request:
DELETE /campaigns/1 HTTP/1.1 Host: 127.0.0.1
Example response:
HTTP/1.1 204 No Content
- Request Headers
Authorization – Optional Apikey value
- Status Codes
204 No Content – Campaign deleted
401 Unauthorized – Invalid role to perform this action
404 Not Found – Campaign ID not found
409 Conflict – Unable to delete campaign due to foreign key constraints