please use root names in all json responses

please use root names in all json responses

in API Development

Posted by: codeofficer.6384

codeofficer.6384

The use of root names in the JSON API is currently inconsistent. Right now if you query the /event_names.json endpoint you get ….

<code>
[{"id":“D1323424-379E-4FED-9DF0-1D7763329BC7”,“name”:“Stop the skritt burglar before it escapes with the treasure.”},{…},{…},{…}]
</code>

… but if you query the /events.json endpoint you get …

<code>
{"events":[{"world_id":1001,map_id,“event_id”:“A8D1A2B7-1F1B-413D-8E64-06CA0D26712D”,“state”:"Inactive"},{…},{…},{…}]}
</code>

In the second example you are using a root name. I would love to see all data from the api returned this way for consistency. To reiterate, the 1st example SHOULD be ….

<code>
{"event_names":[{"id":“D1323424-379E-4FED-9DF0-1D7763329BC7”,“name”:“Stop the skritt burglar before it escapes with the treasure.”},{…},{…},{…}]}
</code>

If you’d like me to argue the case for why a little further I would be happy to, but I think in most circles this is obviously the preferred way to return model data.

Thoughts from the API dev team?

please use root names in all json responses

in API Development

Posted by: rodadams.5963

rodadams.5963

While I agree whole heartedly with the premise, I’ll state that I’d prefer them spending their time on getting as much data out to us as quickly and reliably as they can.
If, for some perverted version of reality, having a field with a uuencoded arj file containing an xml doc was the fastest way to get it out… then I’d be okay with it.

(Though, sweet diety, I do not want to think about the system which would make that the natural way to put the data out.)

Things such as this are good for v2 of the API. Let’s finish v1 first. :-)

please use root names in all json responses

in API Development

Posted by: Pentose.3479

Pentose.3479

I’d rather they not change it now, just make it consistent in the future and maybe fix in v2. Having such a change on the live version would break things.

ASTC – HoD
Wuverlay – a helper overlay for WvW – http://wuv.pento.se