Get Category Attributes Values
getapi.bunnystudio.com/categories/{id}/attribute/{attributeId}/values
This endpoint returns all the available categories on the API.
Requirements
Authentication
Scope
Request example
- Console
- JavaScript
- Python
- PHP - CURL
curl --request GET \
--url https://api.bunnystudio.com/categories/CATEGORY_ID/attribute/ATTRIBUTE_ID/values \
--header "x-access-token: YOUR_TOKEN" \
const url = 'https://api.bunnystudio.com/categories/CATEGORY_ID/attribute/ATTRIBUTE_ID/values';
const options = {
method: 'GET',
headers: {
'x-access-token': 'YOUR_TOKEN',
}
};
fetch(url, options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
import requests
import json
api_url = "https://api.bunnystudio.com/categories/CATEGORY_ID/attribute/ATTRIBUTE_ID/values"
headers = {
'x-access-token': 'YOUR_TOKEN',
}
response = requests.get(api_url, headers=headers)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.bunnystudio.com/categories/CATEGORY_ID/attribute/ATTRIBUTE_ID/values',
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'x-access-token': 'YOUR_TOKEN',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Response format
id
string
ID of the attribute
ID of the attribute
name
string
Name of the attribute
Name of the attribute
Response example
[
{
"id": "eng-us",
"name": "English - North America",
}
...
]
Error responses
500 Not attributes values
{
status: 500,
type: 'NOT_ATTRIBUTES__VALUES',
message: 'There was an error getting all the values of thr attributes of the category, please talk with our support team',
}
404 Attribute no values
{
status: 404,
type: 'ATTRIBUTE_NO_VALUES',
message: 'Attribute "\ATTRIBUTE_ID\" from sub-category "\ID\" does not have selectable values',
}
422 Category not authorized
{
status: 422,
type: 'CATEGORY_NOT_AUTHORIZED',
message: 'The category selected is not Authorized for API projects,
}
422 Attribute not in category
{
status: 422,
type: 'ATTRIBUTE_NOT_CATEGORY',
message: 'Attribute "\ATTRIBUTE_ID\" does not belong to sub-category "\ID\"',
}
422 Id required
{
status: 422,
type: 'ID_REQUIRED',
message: 'The field "\id\" is required',
}
422 Attribute Id required
{
status: 422,
type: 'ATTRIBUTE_ID_REQUIRED',
message: 'The field "\attributeId\" is required',
}
403 Forbidden
{
status: 403,
type: 'FORBIDDEN',
message: 'You do not have permission to do this action',
}