Fields
Fields can be assigned to subscribers
List all fields
If you want to list all of your fields, use this GET
endpoint
GET https://connect.mailerlite.com/api/fields
1
Request parameters
Parameter | Type | Required | Limitations |
---|---|---|---|
limit | integer | no | An account can have at most a 100 groups |
page | integer | no | Count starts from 1 |
filter[keyword] | string | no | Returns partial matches |
filter[type] | string | no | Can be one of the following: text, number or date |
sort | string | no | Can be one of: name , type , Defaults to ascending order; prepend - , e.g. -name for descending order. |
Response
Response Code: 200 OK
1
{
"data": [
{
"id": "1",
"name": "new field",
"key": "new_field",
"type": "text"
}
],
"links": {
"first": "https://connect.mailerlite.com/api/fields?page=1",
"last": "https://connect.mailerlite.com/api/fields?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/fields?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"path": "https://connect.mailerlite.com/api/fields",
"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
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
Create a field
If you want to create a field that can be assigned to subscribers, use this POST
request
POST https://connect.mailerlite.com/api/fields
1
Request body
Parameter | Type | Required | Limitations |
---|---|---|---|
name | string | yes | Maximum length of 255 characters |
type | string | yes | Can be text, number or date |
Response
Response Code: 200 OK
1
{
"data": {
"id": "1",
"name": "new field",
"key": "new_field",
"type": "text"
}
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Error
If invalid data has been passed
Response Code: 422 Unprocessable Entity
1
{
"message": "The given data was invalid.",
"errors": {
"type": ["The selected type is invalid."]
}
}
1
2
3
4
5
6
2
3
4
5
6
Update a field
If you want to update a field, use this PUT
request
PUT https://connect.mailerlite.com/api/fields/{field_id}
1
Request body
Parameter | Type | Required | Limitations |
---|---|---|---|
name | string | yes | Maximum length of 255 characters |
Response
Response Code: 200 OK
1
{
"data": {
"id": "1",
"name": "new field",
"key": "new_field",
"type": "text"
}
}
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Error
If invalid data has been passed
Response Code: 422 Unprocessable Entity
1
{
"message": "The given data was invalid.",
"errors": {
"type": ["The name may not be greater than 255 characters."]
}
}
1
2
3
4
5
6
2
3
4
5
6
Delete a field
If you want to delete a field, use this DELETE
request
DELETE https://connect.mailerlite.com/api/fields/{field_id}
1
Response
Response code: 204 No Content
1
Error
Response Code: 404 Not found
1