Describes how to view an individual custom field, and the entire collection of custom fields in a user's account.
GET the custom_field collection
Make a GET call to the /contact_custom_fields
endpoint to retrieve the collection.
Query Parameters
This method does not currently support filtering results using the custom fields updated_at
timestamp.
Example GET Collection Call
GET https://api.cc.email/v3/contact_custom_fields
Endpoint Requirements
User privileges: contacts:read
Authorization scopes: contact_data
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.cc.email/v3/contact_custom_fields")
.get()
.addHeader("Accept", "application/json")
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer {access_token}")
.build();
Response response = client.newCall(request).execute();
curl -X GET \
'https://api.cc.email/v3/contact_custom_fields' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cc.email/v3/contact_custom_fields');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Authorization' => 'Bearer {access_token}',
'Content-Type' => 'application/json',
'Accept' => 'application/json'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
Response
{
"custom_fields": [
{
"custom_field_id": "{custom_field_id}",
"label": "first purchase",
"name": "first_purchase",
"type": "date",
"updated_at": "2015-02-02T15:14:16-05:00",
"created_at": "2015-02-02T15:14:16-05:00"
},
{
"custom_field_id": "{custom_field_id}",
"label": "maintenance contract",
"name": "maintenance_contract",
"type": "string",
"updated_at": "2016-07-08T12:22:33-04:00",
"created_at": "2016-07-08T12:22:33-04:00"
},
{
"custom_field_id": "{custom_field_id}",
"label": "Delivery preference",
"name": "Delivery_preference",
"type": "string",
"updated_at": "2017-08-23T12:29:50-04:00",
"created_at": "2017-08-23T12:29:50-04:00"
}
]
}
GET an individual custom_field
Use the custom_field_id
path parameter to specify an individual custom_field resource.
Example GET Resource Call
GET https://api.cc.email/v3/contact_custom_fields/{custom_field_id}
Endpoint Requirements
User privileges: contacts:read
Authorization scopes: contact_data
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"label\": \"first purchase or lease\",\n \"type\": \"date\"\n}");
Request request = new Request.Builder()
.url("https://api.cc.email/v3/contact_custom_fields/{custom_field_id}")
.get()
.addHeader("Accept", "application/json")
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer {access_token}")
.build();
Response response = client.newCall(request).execute();
curl -X GET \
https://api.cc.email/v3/contact_custom_fields/{custom_field_id} \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access_token}' \
-H 'Content-Type: application/json' \
<?php
$request = new HttpRequest();
$request->setUrl('https://api.cc.email/v3/contact_custom_fields/{custom_field_id}');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders(array(
'Authorization' => 'Bearer {access_token}',
'Content-Type' => 'application/json',
'Accept' => 'application/json'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
Response
{
"custom_field_id": "{custom_field_id}",
"label": "first purchase or lease",
"name": "first_purchase_or_lease",
"type": "date",
"updated_at": "2018-06-25T17:01:08-04:00",
"created_at": "2015-02-02T15:14:16-05:00"
}