API

Tags

Index

Retrieve a paginated list of tags.

Usage

Endpoint

GET /api/v1/tags

Expected Response Code

200

Response Fields

  • data: array<object>
    • id: int
    • name: string
    • created_at: datetime
    • updated_at: datetime

Sample Request

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

Sample Response

 1{
 2    "data": [
 3        {
 4            "id": 1,
 5            "name": "Test Tag",
 6            "created_at": "2020-03-23 12:44:14",
 7            "update_at": "2020-03-23 12:44:14"
 8        }
 9    ],
10    "links": {
11        "first": "<https://sendyak.local/api/v1/tags?page=1>",
12        "last": "<https://sendyak.local/api/v1/tags?page=1>",
13        "prev": null,
14        "next": null
15    },
16    "meta": {
17        "current_page": 1,
18        "from": 1,
19        "last_page": 1,
20        "path": "<https://sendyak.local/api/v1/tags>",
21        "per_page": 25,
22        "to": 1,
23        "total": 1
24    }
25}

Show

Get details of a single tag.

Usage

Endpoint

GET /api/v1/tags/{tagId}

Expected Response Code

200

Response Fields

  • data: object
    • id: int
    • name: string
    • created_at datetime
    • updated_at datetime

Sample Request

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

Sample Response

1{
2    "data": {
3        "id": 1,
4        "name": "Test Tag",
5        "created_at": "2020-03-23 12:44:14",
6        "update_at": "2020-03-23 12:44:14"
7    }
8}

Store

Create a new tag, optionally including subscribers that should have it assigned to them.

Usage

Endpoint

POST /api/v1/tags

Expected Response Code

201

Request Fields

  • name: string
  • subscribers: array<int> (optional)

Response Fields

  • data: object
    • id: int
    • name: string
    • subscribers: array<object>
      • id: int
      • first_name: string
      • last_name: string
      • email: string
      • created_at: datetime
      • updated_at: datetime
    • created_at: datetime
    • updated_at: datetime

Sample Request

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

{
	"name": "Test Tag Two",
	"subscribers": [1]
}

Sample Response

 1{
 2    "data": {
 3        "id": 2,
 4        "name": "Test Tag Two",
 5        "subscribers": [
 6            {
 7                "id": 1,
 8                "first_name": "Test",
 9                "last_name": "Subscriber",
10                "email": "[email protected]",
11                "created_at": "2020-03-23 13:44:09",
12                "updated_at": "2020-03-23 13:44:09"
13            }
14        ],
15        "created_at": "2020-03-24 08:45:55",
16        "update_at": "2020-03-24 08:45:55"
17    }
18}

Update

Update the details of the given tag. If you wish to adjust the subscribers associated with the tag, see the Tag Subscribers API.

Usage

Endpoint

PUT /api/v1/tags/{tagId}

Expected Response Code

200

Request Fields

  • name: string

Response Fields

  • data: object
    • id: int
    • name: string
    • created_at datetime
    • updated_at datetime

Sample Request

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

{
	"name": "Updated Tag"
}

Sample Response

1{
2    "data": {
3        "id": 2,
4        "name": "Updated Tag",
5        "created_at": "2020-03-24 08:45:55",
6        "update_at": "2020-03-24 08:57:21"
7    }
8}

Delete

Delete the given tag.

Endpoint

DELETE /api/v1/tags/{tagId}

Expected Response Code

204

Sample Request

DELETE /api/v1/tags/2 HTTP/1.1
Host: sendyak.local
Authorization: Bearer 9w2fN7d4F3Banyv7gihYOWJEH6MvtYyZ
Accept: application/json