Custom fields
Define the extra fields your companies, persons and deals carry.
On this page
List custom fields
GET /crm/v1/custom-fields
Returns the custom fields you defined.
Parameters
| Name | In | Type | Required | Meaning |
|---|---|---|---|---|
entity | query | string | Nooptional | Only the fields of this kind of record. One of company, person, deal |
limit | query | integer | Nooptional | Records per page. Default 100 Range 1 – 500 |
cursor | query | string | Nooptional | The nextCursor of the previous page. |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | A page of records. | CustomFieldPage |
400 | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. fields names each one. | Error |
401 | The token is missing, expired or not ours. | Error |
403 | The token does not give access to this company or operation. | Error |
429 | The request was refused and not processed: the code is rate_limited. Wait the seconds in the header Retry-After, then send it again with the same operationId. | Error |
503 | The service cannot answer now: the code is unavailable. Send the request again with the same operationId. | Error |
Request
curl
curl "$RDC_BASE_URL/crm/v1/custom-fields?limit=20" \
-H "Authorization: Bearer $RDC_TOKEN" JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/custom-fields?limit=20`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
},
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'GET',
f'{os.environ["RDC_BASE_URL"]}/crm/v1/custom-fields?limit=20',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
)
result = response.json() PHP
<?php
$curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/custom-fields?limit=20');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
],
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/custom-fields?limit=20");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); Response 200
{
"items": [
{
"id": "51c6f282-fa5a-4793-a4e6-aeeb11b8f054",
"entity": "company",
"key": "delivery_days",
"label": "Delivery days",
"type": "text",
"options": null,
"revision": 1
}
],
"nextCursor": null
} Create a custom field
POST /crm/v1/custom-fields
Defines a field that every company, person or deal then carries in customFields.
Request body
| Field | Type | Required | Meaning |
|---|---|---|---|
operationId | string (uuid) | Yesrequired | A UUID you choose for this change. Send it again to repeat the request. |
entity | string | Yesrequired | The kind of record that carries the field. One of company, person, deal |
key | string | Yesrequired | The key of the field in customFields: lower case letters, digits and underscores, starting with a letter. |
label | string | Yesrequired | The name people see. |
type | string | Yesrequired | The type of the value. One of text, decimal, date, choice |
options | string[] | Nooptional | The allowed values. Required for choice. |
Responses
| Status | Meaning | Body |
|---|---|---|
202 | The change was accepted. The body is the operation result. | OperationResult |
400 | The request cannot be read or breaks the contract: malformed JSON, a missing or unknown field, a wrong type. fields names each one. | Error |
401 | The token is missing, expired or not ours. | Error |
403 | The token does not give access to this company or operation. | Error |
409 | The request was refused. The code is operation_reused. | Error |
429 | The request was refused and not processed: the code is rate_limited. Wait the seconds in the header Retry-After, then send it again with the same operationId. | Error |
503 | The service cannot answer now: the code is unavailable. Send the request again with the same operationId. | Error |
Request
curl
curl -X POST "$RDC_BASE_URL/crm/v1/custom-fields" \
-H "Authorization: Bearer $RDC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationId": "95242917-1d3d-49e3-97c6-c26acc3318fa",
"entity": "company",
"key": "delivery_days",
"label": "Delivery days",
"type": "text"
}' JavaScript
const response = await fetch(`${process.env.RDC_BASE_URL}/crm/v1/custom-fields`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.RDC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"operationId": "95242917-1d3d-49e3-97c6-c26acc3318fa",
"entity": "company",
"key": "delivery_days",
"label": "Delivery days",
"type": "text"
}),
});
const result = await response.json(); Python
import os
import requests
response = requests.request(
'POST',
f'{os.environ["RDC_BASE_URL"]}/crm/v1/custom-fields',
headers={
'Authorization': f'Bearer {os.environ["RDC_TOKEN"]}',
},
json={
'operationId': '95242917-1d3d-49e3-97c6-c26acc3318fa',
'entity': 'company',
'key': 'delivery_days',
'label': 'Delivery days',
'type': 'text',
},
)
result = response.json() PHP
<?php
$body = <<<'JSON'
{
"operationId": "95242917-1d3d-49e3-97c6-c26acc3318fa",
"entity": "company",
"key": "delivery_days",
"label": "Delivery days",
"type": "text"
}
JSON;
$curl = curl_init(getenv('RDC_BASE_URL') . '/crm/v1/custom-fields');
curl_setopt_array($curl, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RDC_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
]);
$result = json_decode(curl_exec($curl), true);
curl_close($curl); C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, $"{Environment.GetEnvironmentVariable("RDC_BASE_URL")}/crm/v1/custom-fields");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("RDC_TOKEN"));
request.Content = new StringContent("""
{
"operationId": "95242917-1d3d-49e3-97c6-c26acc3318fa",
"entity": "company",
"key": "delivery_days",
"label": "Delivery days",
"type": "text"
}
""", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
var result = await response.Content.ReadAsStringAsync(); Response 202
{
"operationId": "95242917-1d3d-49e3-97c6-c26acc3318fa",
"status": "accepted",
"aggregateRevision": 1
}