curl --request POST \
--url https://{organization}.rescueconsole.com/api/animals/custom-fields \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity_type": "animal",
"field_key": "sponsor_name",
"field_label": "Sponsor",
"field_type": "select",
"options": [
"Contoso Pet Supply",
"Private sponsor"
],
"required": false,
"sort_order": 10
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entity_type: 'animal',
field_key: 'sponsor_name',
field_label: 'Sponsor',
field_type: 'select',
options: ['Contoso Pet Supply', 'Private sponsor'],
required: false,
sort_order: 10
})
};
fetch('https://{organization}.rescueconsole.com/api/animals/custom-fields', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{organization}.rescueconsole.com/api/animals/custom-fields"
payload = {
"entity_type": "animal",
"field_key": "sponsor_name",
"field_label": "Sponsor",
"field_type": "select",
"options": ["Contoso Pet Supply", "Private sponsor"],
"required": False,
"sort_order": 10
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"entity_type": "animal",
"field_key": "<string>",
"field_label": "<string>",
"field_type": "text",
"options": [
"<string>"
],
"required": true,
"sort_order": 123
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}Add a custom field
Defines a new field. Its key, the kind of record it belongs to and its type cannot be changed afterwards. A record cannot be created without a value for a required field. Needs admin on Animals.
curl --request POST \
--url https://{organization}.rescueconsole.com/api/animals/custom-fields \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity_type": "animal",
"field_key": "sponsor_name",
"field_label": "Sponsor",
"field_type": "select",
"options": [
"Contoso Pet Supply",
"Private sponsor"
],
"required": false,
"sort_order": 10
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entity_type: 'animal',
field_key: 'sponsor_name',
field_label: 'Sponsor',
field_type: 'select',
options: ['Contoso Pet Supply', 'Private sponsor'],
required: false,
sort_order: 10
})
};
fetch('https://{organization}.rescueconsole.com/api/animals/custom-fields', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{organization}.rescueconsole.com/api/animals/custom-fields"
payload = {
"entity_type": "animal",
"field_key": "sponsor_name",
"field_label": "Sponsor",
"field_type": "select",
"options": ["Contoso Pet Supply", "Private sponsor"],
"required": False,
"sort_order": 10
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"entity_type": "animal",
"field_key": "<string>",
"field_label": "<string>",
"field_type": "text",
"options": [
"<string>"
],
"required": true,
"sort_order": 123
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}Authorizations
An API key from Settings, API keys. It starts with rc_live_.
Body
The kind of record a custom field belongs to: an animal, a housing unit, or an adoption application.
animal, location_unit, adoption_application Lowercase letters, digits and underscores, starting with a letter. Unique within the kind of record.
^[a-z][a-z0-9_]*$What a value of the field must be. text a string; textarea a string of at most 5,000 characters; number a number; boolean true or false; date a date string; select one of the options; multiselect a list of the options; phone a phone number; email an email address; url an address starting http:// or https://; country_state an object with a two-letter country code and an optional state.
text, textarea, number, boolean, date, select, multiselect, phone, email, url, country_state Required, and not empty, for a select or multiselect.
Response
The field, as it was created.
The kind of record a custom field belongs to: an animal, a housing unit, or an adoption application.
animal, location_unit, adoption_application The key the value is stored under in a record's custom_fields.
The name staff see on the form.
What a value of the field must be. text a string; textarea a string of at most 5,000 characters; number a number; boolean true or false; date a date string; select one of the options; multiselect a list of the options; phone a phone number; email an email address; url an address starting http:// or https://; country_state an object with a two-letter country code and an optional state.
text, textarea, number, boolean, date, select, multiselect, phone, email, url, country_state The choices, for a select or multiselect. Empty for the other types.
Whether a record cannot be created without a value.