Closed humboldtux closed 8 years ago
I agree with changing the response, that sounds more logical to me.
@humboldtux changes have been made to the master branch; could you please test it and close this ticket if it is ok for you? Many thanks!
This is on the orthagh:9.1/apijson.org_compat branch, not on the master; sorry for the confusion.
I get:
{
"active_entity": {
"id": 1,
"active_entity_recursive": true,
"active_entities": [1, 2]
}
}
Where
{
"active_entity": {
"id": 1,
"active_entity_recursive": true,
"active_entities": [{
"id": 1
}, {
"id": 2
}]
}
}
would be easier to parse.
still on my fork, you should have an array instead of an object on key active_entities
Fixed in the master, the real one! :)
@orthagh, whether from updated master or your fork, i'm still getting
{
"active_entity": {
"id": 1,
"active_entity_recursive": true,
"active_entities": [1, 2]
}
}
Is it the definitive response you want to return? not:
{
"active_entity": {
"id": 1,
"active_entity_recursive": true,
"active_entities": [{
"id": 1
}, {
"id": 2
}]
}
}
It shouldn't : https://github.com/glpi-project/glpi/commit/406f0fe85967f4dcfff4cea0c4e9129ea099d778#diff-e01cdca9469fc2d2fa8a60ea83250903R303
It's now on this repo master
Using latest master, I still have the incorrect output:
{
"active_entity": {
"id": 0,
"active_entity_recursive": 1,
"active_entities": [
0,
1,
2,
3
]
}
}
oh ok, i missed you want this kind of output
I get this answer by requesting /getActiveEntities:
$ curl -H "Session-Token: 7r7436i0u4m0qqdn0v5rc43el5" 'http://glpi.lan:8080/apirest.php/getActiveEntities'
{"active_entity":1,"active_entity_recursive":true,"active_entities":{"1":1,"2":2}}
Where, from the official API documentation, the response should be:
{"active_entity":1,"active_entity_recursive":true,"active_entities":[{"1":1},{"2":2}]}
Even better, could the reponse of this endpoint be changed to:
{"active_entity":{"id":1,"active_entity_recursive":true,"active_entities":[{"id":1},{"id":2}]}}
It follows http://jsonapi.org/, and is easier to parse.
I'm using Master. Server configuration: