Bug #157
mn_service getObjects reponse is dictionary rather than list
100%
Description
The response from getObjects of a MN should be a dictionary that contains a list of records. The current response is a dictionary of dictionaries which will not preserve the order in which they are produced from the service.
History
#1 Updated by Roger Dahl almost 15 years ago
- Status changed from New to Closed
I think that there's an issue with the JSON example in the REST interface doc:
{'start': ,
'count': ,
'total': ,
'data': [: {'oclass':,
'hash':,
'modified':,
'size':},
...]}
The 'value' for data is a list, but the first item in the list is specified as a dictionary key (which can't be done without first starting a dictionary).
I considered the following as a possibility:
"count": 5,
"start": 0,
"total": 195,
"data": [
{
"8f271e14-7b75-4b04-8225-8934017e2b21_meta": {
"oclass": "metadata",
"hash": "ba3d9b83bdcb98944f1d9bd514fab6ecd09f942e",
"modified": "2010-01-06T11:28:05",
"size": 7
}
}, ...
]
}
But this doesn't really make much sense either, because there's no point in having a series of dictionaries with just one item in each dictionary. Instead, I did:
{
"count": 5,
"start": 0,
"total": 195,
"data": [
{
"size": 7,
"guid": "8f271e14-7b75-4b04-8225-8934017e2b21_meta",
"hash": "ba3d9b83bdcb98944f1d9bd514fab6ecd09f942e",
"modified": "2010-01-06T11:28:05",
"oclass": "metadata"
}, ...
]
}
So, there's a list of dictionaries, and the guid is one of the dictionary items for each object.
#2 Updated by Dave Vieglais almost 15 years ago
REST docs have been updated to match the last example above (i.e. data is a list of dictionaries).