Preferences are custom fields created under the preferences category which helps in capturing specific interests of a customer. Example: favorite color, favorite brand. This API allows you to set or update preferences of a customer.
Example request
curl --location 'https://eu.api.capillarytech.com/v1.1/customer/preferences?format=json' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'accept: application/json' \
--data-raw '{
"root": {
"customer": [
{
"mobile": "7744876415",
"email": "[email protected]",
"store": {
"code": "doc123",
"id": "75152715"
}
}
]
}
}'
Request Body Parameters
Field | Type | Required | Description |
---|---|---|---|
root | object | Yes | Root object containing customer data. |
| array | Yes | Array of customer objects. At least one customer object is required. |
| string | Conditional | Customer's mobile number. Conditionally required Customer's mobile number. At least one identifier among mobile, email, external_id, or user_id should be provided. |
string | Conditional | Customer's email address. | |
| string | Conditional | External identifier for the customer (optional). |
| string | Conditional | Unique user ID for the customer (optional). |
| object | Optional | Store details object. |
-- code | string | Optional | Store code to which the customer belongs. |
-- id | string | Optional | Store ID. Unique identifier for the store associated with the customer. Pass the internal store ID configured in your system. |
| object | Optional | Object containing custom field data (optional). |
-- field | array | Optional | Array of custom field objects. Each defines additional attribute information. |
--- name | string | Yes | Name of the custom field. (if custom_fields.field provided) Preference/attribute name (e.g., "Favorite Brand"). |
--- value | string | Yes | Value for the custom field. Write string values directly (e.g., |
Example response
{
"response": {
"status": {
"success": "false",
"code": 500,
"message": "All requests have failed due to errors"
},
"customer": [
{
"mobile": "917744876415",
"email": "[email protected]",
"external_id": "",
"store": {
"status": "SUCCESS",
"id": "75152715",
"code": "doc123",
"name": "DocStore"
},
"custom_fields": {
"field": []
},
"item_status": {
"success": "false",
"code": 999999,
"message": "",
"warnings": {}
}
}
]
}
}
API Specific Error Code
Error Code | Description | Reason |
---|---|---|
999999 | Unexpected server error. | Returned when an unhandled or unknown error occurs during request processing. Used as a fallback for unexpected failures. |
400 | Bad request. | Triggered when required fields are missing or request body is malformed. |
401 | Unauthorized. | Authentication failed or missing authorization header. |
403 | Forbidden. | User does not have permission to perform this operation. |
404 | Customer not found. | Passed identifier (e.g., mobile, email) does not match any customer record. |
409 | Conflict. | Duplicate or conflicting data detected in the request. |
422 | Unprocessable entity. | Input is semantically incorrect (e.g., invalid email format, unsupported store code). |
500 | Internal server error. | Server encountered an error while processing the request. |