Replace age groups
Replaces every age group for every species with what you send. A species you leave out, or send as an empty list, loses its own groups and falls back to the every-species set, or to the built-in four when there is none. Within a species the groups go youngest first; each ends where you say, the next starts there, and the last must have no upper age. A group that a fee rule names cannot be removed (409). Needs admin on Animals.
PUT
https://{organization}.rescueconsole.com
/
api
/
animals
/
age-groups
Replace age groups
curl --request PUT \
--url https://{organization}.rescueconsole.com/api/animals/age-groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"groups": {
"": [
{
"value": "baby",
"label": "Baby",
"upper": {
"value": 1,
"unit": "year"
}
},
{
"value": "young",
"label": "Young",
"upper": {
"value": 3,
"unit": "year"
}
},
{
"value": "adult",
"label": "Adult",
"upper": {
"value": 7,
"unit": "year"
}
},
{
"value": "senior",
"label": "Senior",
"upper": null
}
],
"rabbit": [
{
"value": "kit",
"label": "Kit",
"upper": {
"value": 6,
"unit": "month"
}
},
{
"value": "adult",
"label": "Adult",
"upper": {
"value": 5,
"unit": "year"
}
},
{
"value": "senior",
"label": "Senior",
"upper": null
}
]
}
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
groups: {
'': [
{value: 'baby', label: 'Baby', upper: {value: 1, unit: 'year'}},
{value: 'young', label: 'Young', upper: {value: 3, unit: 'year'}},
{value: 'adult', label: 'Adult', upper: {value: 7, unit: 'year'}},
{value: 'senior', label: 'Senior', upper: null}
],
rabbit: [
{value: 'kit', label: 'Kit', upper: {value: 6, unit: 'month'}},
{value: 'adult', label: 'Adult', upper: {value: 5, unit: 'year'}},
{value: 'senior', label: 'Senior', upper: null}
]
}
})
};
fetch('https://{organization}.rescueconsole.com/api/animals/age-groups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{organization}.rescueconsole.com/api/animals/age-groups"
payload = { "groups": {
"": [
{
"value": "baby",
"label": "Baby",
"upper": {
"value": 1,
"unit": "year"
}
},
{
"value": "young",
"label": "Young",
"upper": {
"value": 3,
"unit": "year"
}
},
{
"value": "adult",
"label": "Adult",
"upper": {
"value": 7,
"unit": "year"
}
},
{
"value": "senior",
"label": "Senior",
"upper": None
}
],
"rabbit": [
{
"value": "kit",
"label": "Kit",
"upper": {
"value": 6,
"unit": "month"
}
},
{
"value": "adult",
"label": "Adult",
"upper": {
"value": 5,
"unit": "year"
}
},
{
"value": "senior",
"label": "Senior",
"upper": None
}
]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"groups": {},
"units": [
"day"
],
"in_use_by_fees": [
"<string>"
]
}{
"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
Body
application/json
Response
The age groups, as they now are.
⌘I
Replace age groups
curl --request PUT \
--url https://{organization}.rescueconsole.com/api/animals/age-groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"groups": {
"": [
{
"value": "baby",
"label": "Baby",
"upper": {
"value": 1,
"unit": "year"
}
},
{
"value": "young",
"label": "Young",
"upper": {
"value": 3,
"unit": "year"
}
},
{
"value": "adult",
"label": "Adult",
"upper": {
"value": 7,
"unit": "year"
}
},
{
"value": "senior",
"label": "Senior",
"upper": null
}
],
"rabbit": [
{
"value": "kit",
"label": "Kit",
"upper": {
"value": 6,
"unit": "month"
}
},
{
"value": "adult",
"label": "Adult",
"upper": {
"value": 5,
"unit": "year"
}
},
{
"value": "senior",
"label": "Senior",
"upper": null
}
]
}
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
groups: {
'': [
{value: 'baby', label: 'Baby', upper: {value: 1, unit: 'year'}},
{value: 'young', label: 'Young', upper: {value: 3, unit: 'year'}},
{value: 'adult', label: 'Adult', upper: {value: 7, unit: 'year'}},
{value: 'senior', label: 'Senior', upper: null}
],
rabbit: [
{value: 'kit', label: 'Kit', upper: {value: 6, unit: 'month'}},
{value: 'adult', label: 'Adult', upper: {value: 5, unit: 'year'}},
{value: 'senior', label: 'Senior', upper: null}
]
}
})
};
fetch('https://{organization}.rescueconsole.com/api/animals/age-groups', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{organization}.rescueconsole.com/api/animals/age-groups"
payload = { "groups": {
"": [
{
"value": "baby",
"label": "Baby",
"upper": {
"value": 1,
"unit": "year"
}
},
{
"value": "young",
"label": "Young",
"upper": {
"value": 3,
"unit": "year"
}
},
{
"value": "adult",
"label": "Adult",
"upper": {
"value": 7,
"unit": "year"
}
},
{
"value": "senior",
"label": "Senior",
"upper": None
}
],
"rabbit": [
{
"value": "kit",
"label": "Kit",
"upper": {
"value": 6,
"unit": "month"
}
},
{
"value": "adult",
"label": "Adult",
"upper": {
"value": 5,
"unit": "year"
}
},
{
"value": "senior",
"label": "Senior",
"upper": None
}
]
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"groups": {},
"units": [
"day"
],
"in_use_by_fees": [
"<string>"
]
}{
"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)"
}
