Single embedded elements output format
By default, following HAL specification, when only one embedded element is returned, it is represented as an object. Multiple elements are represented as an array of objects.
Since Keepeek version 4.20.0, this behavior can be changed by setting the request parameter forceArrays
to true
. This will force embedded representations as list, whatever the number of elements.
- Default response with only one embedded element :
GET http://baobab.keepeek.com/api/dam/search/media?fields=id&f=title:Cycles
[...]
HTTP/1.1 200 OK
Content-Type: application/hal+json;version=1;charset=UTF-8
[...]
{
{
"_links": {
[...]
},
"_embedded": {
"media": {
"id": 1945,
"_links": {
[...]
}
},
"selected-filter": {
[...]
}
},
"totalCount": 1
}
- Response of the same request with
forceArrays
parameter set to true :
GET http://baobab.keepeek.com/api/dam/search/media?fields=id&f=title:Cycles&forceArrays=true
[...]
HTTP/1.1 200 OK
Content-Type: application/hal+json;version=1;charset=UTF-8
[...]
{
{
"_links": {
[...]
},
"_embedded": {
"media": [
{
"id": 1945,
"_links": {}
}
],
"selected-filter": []
},
"totalCount": 1
}