E-commerce Categories Products API
Assign/unassign products to categories
Get the products of a category
If you want to get the products for a particular shop and a category, send this GET
request
GET https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id/products
1
Request parameters
Parameter | Type | Required | Limitations |
---|---|---|---|
shop_id | integer | yes | Must provide valid shop id |
category_id | integer | yes | Must provide category id |
limit | integer | no | Defaults to 100 |
page | integer | no | Defaults to 1 |
Response
{
"data": [
{
"id": "31986843543567834",
"name": "Product name",
"price": 123.4,
"url": "https://shop-url.com/product-name",
"image": "https://shop-url.com/product-image.jpg",
"exclude_from_automations": false,
"categories": [
{
"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"
},
{
"id": "1234566457534278",
"name": "Category 2",
"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/:category_id/products?page=1",
"last": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id/products?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/:category_id/products?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"path": "https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id/products",
"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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Assign a product to a category
If you want to assign a product to a category for a given shop, send this PUT
request
PUT https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id/products/:product_id
1
Request body
Parameter | Type | Required | Limitations |
---|---|---|---|
shop_id | integer | yes | Must provide valid shop id |
category_id | integer | yes | Must provide category id |
product_id | integer | yes | Must provide product id |
Response
If the product was assigned to the category:
Response Code: 200 OK
1
{
"data": {
"id": "31986843543567834",
"name": "Product name",
"price": 123.4,
"url": "https://shop-url.com/product-name",
"image": "https://shop-url.com/product-image.jpg",
"exclude_from_automations": false,
"categories": [
{
"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"
},
{
"id": "1234566457534278",
"name": "Category 2",
"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
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
Error
Response Code: 422 Unprocessable Entity
1
The error response will contain information about the invalid data.
{
"message": "The given data was invalid.",
"errors": {
"product_id": ["The product id must be provided."]
}
}
1
2
3
4
5
6
2
3
4
5
6
Unassign a product from a category
If you want to unassign a product from a category for a given shop, send this DELETE
request
DELETE https://connect.mailerlite.com/api/ecommerce/shops/:shop_id/categories/:category_id/products/:product_id
1
Request parameters
Parameter | Type | Required | Limitations |
---|---|---|---|
shop_id | integer | yes | Must provide valid shop id |
category_id | integer | yes | Must provide category id |
product_id | integer | yes | Must provide product id |
Response
Response code: 200 OK
1
{
"id": "31986843543567834",
"name": "Product name",
"price": 123.4,
"url": "https://shop-url.com/product-name",
"image": "https://shop-url.com/product-image.jpg",
"exclude_from_automations": false,
"categories": [
{
"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"
},
{
"id": "1234566457534278",
"name": "Category 2",
"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
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Error
Response code: 404 Not Found
1