API

Campaigns

Campaign Object

  • data: object
    • id: int (readonly)
    • name: string
    • subject: string
    • content: string
    • status_id: int (readonly)
    • template_id: int
    • email_service_id: int
    • from_name: string
    • from_email: string
    • is_open_tracking: bool
    • is_click_tracking: bool
    • sent_count: int (readonly)
    • open_count: int (readonly)
    • click_count: int (readonly)
    • send_to_all: bool
    • tags: array
    • save_as_draft: bool
    • scheduled_at: datetime
    • created_at: datetime (readonly)
    • updated_at: datetime (readonly)

Index

Retrieve a paginated list of all campaigns.

Usage

Endpoint

GET /api/v1/campaigns

Expected Response Code

200

Response Fields

array<Campaign Object>

Sample Request

GET /api/v1/campaigns HTTP/1.1
Host: sendyak.local
Authorization: Bearer 9w2fN7d4F3Banyv7gihYOWJEH6MvtYyZ
Accept: application/json

Sample Response

 1{
 2    "data": [
 3        {
 4            "id": 1,
 5            "name": "name",
 6            "subject": "My Campaign Subject",
 7            "content": "My Email Content",
 8            "status_id": 1,
 9            "template_id": 1,
10            "email_service_id": 1,
11            "from_name": "SendYak",
12            "from_email": "[email protected]",
13            "is_open_tracking": true,
14            "is_click_tracking": true,
15            "sent_count": 0,
16            "open_count": 0,
17            "click_count": 0,
18            "send_to_all": true,
19            "tags": [],
20            "save_as_draft": false,
21            "scheduled_at": "2020-07-24 08:46:54",
22            "created_at": "2020-07-24 08:23:38",
23            "updated_at": "2020-07-24 09:43:42"
24        }
25    ],
26    "links": {
27        "first": "<https://sendyak.local/api/v1/campaigns?page=1>",
28        "last": "<https://sendyak.local/api/v1/campaigns?page=1>",
29        "prev": null,
30        "next": null
31    },
32    "meta": {
33        "current_page": 1,
34        "from": 1,
35        "last_page": 1,
36        "path": "<https://sendyak.local/api/v1/campaigns>",
37        "per_page": 25,
38        "to": 1,
39        "total": 1
40    }
41}

Show

Get details of a single campaign.

Usage

Endpoint

GET /api/v1/campaigns/{campaignId}

Expected Response Code

200

Response Fields

Campaign Object

Sample Request

GET /api/v1/campaigns/1 HTTP/1.1
Host: sendyak.local
Authorization: Bearer 9w2fN7d4F3Banyv7gihYOWJEH6MvtYyZ
Accept: application/json

Sample Response

 1{
 2    "data": {
 3        "id": 1,
 4        "name": "name",
 5        "subject": "My Campaign Subject",
 6        "content": "My Email Content",
 7        "status_id": 1,
 8        "template_id": 1,
 9        "email_service_id": 1,
10        "from_name": "SendYak",
11        "from_email": "[email protected]",
12        "is_open_tracking": true,
13        "is_click_tracking": true,
14        "sent_count": 0,
15        "open_count": 0,
16        "click_count": 0,
17        "send_to_all": true,
18        "tags": [],
19        "save_as_draft": false,
20        "scheduled_at": "2020-07-24 08:46:54",
21        "created_at": "2020-07-24 08:23:38",
22        "updated_at": "2020-07-24 09:43:42"
23    }
24}

Store

Create a new campaign.

Usage

Endpoint

POST /api/v1/campaigns

Expected Response Code

201

Request Fields

  • name: string
  • subject: string
  • content: string
  • template_id: int
  • email_service_id: int
  • from_name: string
  • from_email: string
  • is_open_tracking: bool (optional)
  • is_click_tracking: bool (optional)
  • send_to_all: bool (optional)
  • tags: array<int> (optional)
  • save_as_draft: bool (optional)

Response Fields

Campaign Object

Sample Request

POST /api/campaigns HTTP/1.1
Host: sendyak.local
Authorization: Bearer 9w2fN7d4F3Banyv7gihYOWJEH6MvtYyZ
Accept: application/json
Content-Type: application/json

{
    "subject": "My New Campaign",
    "subject": "My New Campaign Subject",
    "content": "My New Email Content"
    "template_id": "1"
    "email_service_id": "1"
    "from_name": "SendYak"
    "from_email": "[email protected]"
    "is_open_tracking": "1"
    "is_click_tracking": "1"
    "send_to_all": "1"
    "save_as_draft": "0"
    "scheduled_at": "2020-07-24 08:46:54
}

Sample Response

 1{
 2    "data": {
 3        "id": 1,
 4        "name": "name",
 5        "subject": "My New Campaign Subject",
 6        "content": "My New Email Content",
 7        "status_id": 1,
 8        "template_id": 1,
 9        "email_service_id": 1,
10        "from_name": "SendYak",
11        "from_email": "[email protected]",
12        "is_open_tracking": true,
13        "is_click_tracking": true,
14        "sent_count": 0,
15        "open_count": 0,
16        "click_count": 0,
17        "send_to_all": true,
18        "tags": [],
19        "save_as_draft": false,
20        "scheduled_at": "2020-07-24 08:46:54",
21        "created_at": "2020-07-24 08:23:38",
22        "updated_at": "2020-07-24 08:23:38"
23    }
24}

Update

Update a campaign.

Usage

Endpoint

PUT /api/v1/campaigns/{campaignId}

Expected Response Code

200

Request Fields

  • name: string
  • subject: string
  • content: string
  • template_id: int
  • email_service_id: int
  • from_name: string
  • from_email: string
  • is_open_tracking: bool (optional)
  • is_click_tracking: bool (optional)
  • send_to_all: bool (optional)
  • tags: array<int> (optional)
  • save_as_draft: bool (optional)

Response Fields

Campaign Object

Sample Request

PUT /api/v1/campaigns/2 HTTP/1.1
Host: sendyak.local
Authorization: Bearer 9w2fN7d4F3Banyv7gihYOWJEH6MvtYyZ
Accept: application/json
Content-Type: application/json

{
	"subject": "My New Campaign Subject",
	"content": "My New Email Content"
}

Sample Response

 1{
 2    "data": {
 3        "id": 1,
 4        "name": "name",
 5        "subject": "My New Campaign Subject",
 6        "content": "My New Email Content",
 7        "status_id": 1,
 8        "template_id": 1,
 9        "email_service_id": 1,
10        "from_name": "SendYak",
11        "from_email": "[email protected]",
12        "is_open_tracking": true,
13        "is_click_tracking": true,
14        "sent_count": 0,
15        "open_count": 0,
16        "click_count": 0,
17        "send_to_all": true,
18        "tags": [],
19        "save_as_draft": false,
20        "scheduled_at": "2020-07-24 08:46:54",
21        "created_at": "2020-07-24 08:23:38",
22        "updated_at": "2020-07-24 09:43:42"
23    }
24}

Send

Send a campaign.

Usage

Endpoint

POST /api/v1/campaigns/{campaignId}/send

Expected Response Code

200

Request Fields

None

Response Fields

Campaign Object

Sample Request

POST /api/v1/campaigns/2/send HTTP/1.1
Host: sendyak.local
Authorization: Bearer 9w2fN7d4F3Banyv7gihYOWJEH6MvtYyZ
Accept: application/json
Content-Type: application/json

Sample Response

 1{
 2  "data": {
 3    "id": 1,
 4    "name": "name",
 5    "subject": "My New Campaign Subject",
 6    "content": "My New Email Content",
 7    "status_id": 2,
 8    "template_id": 1,
 9    "email_service_id": 1,
10    "from_name": "SendYak",
11    "from_email": "[email protected]",
12    "is_open_tracking": true,
13    "is_click_tracking": true,
14    "sent_count": 0,
15    "open_count": 0,
16    "click_count": 0,
17    "send_to_all": true,
18    "tags": [],
19    "save_as_draft": false,
20    "scheduled_at": "2020-07-24 08:46:54",
21    "created_at": "2020-07-24 08:23:38",
22    "updated_at": "2020-07-24 09:43:42"
23  }
24}