Store Contact Data with Custom Fields
With custom fields, you can store custom data in contacts and use the data with Templates.
Get all custom fields
To get all custom fields, use:
GET /api/v2/customfields
with the parameters:
Name | Required? | Example | Description |
---|---|---|---|
page | No | 3 |
Fetch the specified results page. The default is 1. |
limit | No | 25 |
The number of results per page. The default is 10. |
You will receive the standard paginated response:
Parameter | Example | Description |
---|---|---|
page | 3 |
The current fetched page. |
limit | 25 |
The number of results per page. |
pageCount | 150 |
The total number of pages. |
resources | Array of customfields. | See next section for customfields format response details. |
Get the details of a specific custom field
To get a single custom field, use:
GET /api/v2/customfields/{id}
where id is a custom field ID. Note, this command has no parameters.
You will receive a response in the following format:
Parameter | Example | Description |
---|---|---|
id | 31 |
Custom field ID. |
name | DOB |
Custom field name. |
createdAt | 2015-02-11T07:33:19+0000 |
Custom field creation time. |
Add a new custom field
To add a new custom field, use:
POST /api/v2/customfields
with the following parameters:
Name | Required? | Examples | Description |
---|---|---|---|
name | Yes |
DOB
|
Custom field name. |
If successful, you will receive this response:
Parameter | Example | Description |
---|---|---|
id | 31 |
Custom field ID. |
href | /api/v2/customfields/31 |
Link to Custom field. |
Edit a custom field
To modify a custom field name, use:
PUT /api/v2/customfields/{id}
where id is the custom field ID. Use the command with the same parameters as those used when creating it:
Name | Required? | Examples | Description |
---|---|---|---|
name | Yes |
DOB
|
Custom field name. |
If successful, you’ll receive this response:
Parameter | Example | Description |
---|---|---|
id | 31 |
Custom field ID. |
href | /api/v2/customfields/31 |
Link to Custom field. |
Delete a custom field
To delete a custom field, use:
DELETE /api/v2/customfields/{id}
where id is a custom field ID. Note, this command has no parameters. If successful, this command will return the standard delete response (204 No Content), otherwise the standard error response will be returned.
When a custom field is deleted, all the information that was added to contacts under this custom field will also be lost.
Edit the custom field value of a specified contact
To modify the custom field value of a specified contact, use:
PUT /api/v2/customfields/{id}/update
where id is the custom field ID. Use the following parameters:
Name | Required? | Example | Description |
---|---|---|---|
contactId | Yes | 50315 |
Contact ID. |
value | Yes | 1983-08-31 |
Custom field value. Note that this value is not parsed in any way. It is stored and used in tags exactly as you send it. |
If successful, you will receive this response:
Parameter | Example | Description |
---|---|---|
id | 31 |
Custom field ID. |
href | /api/v2/contacts/50315 |
Link to Contact. |
The next step
You’ve now learned how to manage custom fields via the Textmagic API. Please continue to the next section to learn how to manage your Account via the Textmagic API.