E-commerce Categories API
Get categories
If you want to get all categories of the given shop_id, send this GET
request
GET https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories
1
Request parameters
Parameter | Type | Required | Limitations |
---|---|---|---|
shop_id | integer | yes | Must provide valid shop id |
limit | integer | no | Defaults to 100 |
page | integer | no | Defaults to 1 |
Response
{
"data": [
{
"id": "1234566457534276",
"name": "Category 1",
"exclude_from_automations": false,
"created_at": "2021-09-01 14:03:50",
"updated_at": "2021-09-01 14:03:50"
}
],
"links": {
"first": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories?page=1",
"last": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"path": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories",
"per_page": 100,
"to": 1,
"total": 1
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Create/update category
You can create or update the category of the given shop.
If you want to create the category, send this POST
request
POST https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories
1
If you want to update the category, send this PUT
request
PUT https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id
1
Request body
Parameter | Type | Required | Limitations |
---|---|---|---|
name | string | yes | The category's name |
exclude_from_automations | boolean | no | If true this category will not trigger any automations. Defaults to false |
{
"id": "1234566457534276",
"name": "Category 1",
"exclude_from_automations": false,
"created_at": "2021-09-01 14:03:50",
"updated_at": "2021-09-01 14:03:50"
}
1
2
3
4
5
6
7
2
3
4
5
6
7
Response
If the category was created:
Response Code: 201 Created
1
{
"data": {
"id": "1234566457534276",
"name": "Category 1",
"exclude_from_automations": false,
"created_at": "2021-09-01 14:03:50",
"updated_at": "2021-09-01 14:03:50"
}
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Error
Response Code: 422 Unprocessable Entity
1
The error response will contain information about the invalid data.
{
"message": "The given data was invalid.",
"errors": {
"name": ["The name must be provided."]
}
}
1
2
3
4
5
6
2
3
4
5
6
Fetch a category
If you want to fetch a category for a given shop, send this GET
request
GET https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id
1
Request parameters
Parameter | Type | Required | Limitations |
---|---|---|---|
category_id | integer | yes | Must provide valid category id |
shop_id | integer | yes | Must provide valid shop id |
GET https://connect.mailerlite.com/api/ecommerce/shops/31986843064993537/categories/319868430643456756
1
Response
If the shop and the category exist:
Response Code: 200 OK
1
{
"data": {
"id": "1234566457534276",
"name": "Category 1",
"exclude_from_automations": false,
"created_at": "2021-09-01 14:03:50",
"updated_at": "2021-09-01 14:03:50"
}
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Error
If the category or shop cannot be found:
Response Code: 404 Not Found
1
Fetch total categories count
If you want to fetch the count of all categories, send this GET
request
GET https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories?limit=0
1
Request parameters
Parameter | Type | Required | Limitations |
---|---|---|---|
shop_id | integer | yes | Must provide valid shop id |
limit | integer | yes | Value must be 0 |
Response
Response Code: 200 OK
1
{
"total": 123
}
1
2
3
2
3
Delete a category
If you want to delete a category for the given shop, send this DELETE
request
DELETE https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id
1
Request parameters
Parameter | Type | Required | Limitations |
---|---|---|---|
category_id | integer | yes | Must provide valid category id |
shop_id | integer | yes | Must provide valid shop id |
Response
Response code: 200 OK
1
{
"id": "1234566457534276",
"name": "Category 1",
"exclude_from_automations": false,
"created_at": "2021-09-01 14:03:50",
"updated_at": "2021-09-01 14:03:50"
}
1
2
3
4
5
6
7
2
3
4
5
6
7
Error
Response code: 404 Not Found
1