Topic

[API] Results from skills.learn group JSON objects in an odd way

I know that there are improvements planned for the API coming, and I'm not sure this is exactly a bug, but I think the format coming in now is different than it was previously (and it is different than how other calls are handled.)

Results from the skills.learn command returns something like this:
{"animalhusbandry_1": {
"start": 1293641469,
"end": 1293647559},
"ok": 1}


It seems that the skill name and time information should be treated as a Map entry (name/value pair) because the its label is changing from call to call. The "ok" label seems to be standard across all API calls.
The problem I have with the this way is that if skill and ok are on the same level, it is more difficult for languages with strict typing to handle what is a Map entry and what are your standard fields. Obviously there are ways around this (easiest being hard coding all possible skill_ids) but that isn't ideal. I think the preferred approach is how it is handled in the results from skills.learning where "learning": {} wraps around the Mapped pair.

I think keeping a model similar to that will help keep the API more easily, quickly and fully implementable in other languages.

Posted 13 years ago by Cainunable Subscriber! | Permalink