ontehfritz / api.mtgdb.info

Project closing first of August 2015
http://www.mtgdb.info/
MIT License
36 stars 8 forks source link

Create a low bandwidth less verbose version of the returned JSON #23

Closed ontehfritz closed 10 years ago

ontehfritz commented 10 years ago

Look into create a low bandwidth version, this will make it less easy to use but in circumstances where memory and speed are issues this will be of great benefit to developers using devices with memory restrictions.

mpattee commented 10 years ago

Have you thought about just having a flag you could pass with an updated since date. So then you'd only get results that had changed since you last queried the api.

ontehfritz commented 10 years ago

Hey, Yes and there will be a modified date added in time. However, that won't solve this issue. This issue was created from a request I got via email, it is pretty ambiguous title I created.

The issue was to create a more compact output. Instead of having the name of the field repeat over and over there was a suggestion to have something like:

{ index: ['id','cardName'], data: [ [1,'foo'],[2,'bar'] ] }

index being the field name and the data would be the value, this would reduce the output size. I was assuming the request was coming from a mobile developer or other devices with limited memory.

To solve this I think can simply just create csv output option, which would actually be smaller than the purposed way of doing it with JSON. JSON the nature of JSON just contains more meta data for easy serialization/deserialization.

TL;DR it is about saving bytes on the output.

mpattee commented 10 years ago

I think the problem with that is it limits the json ease of use. What I've seen typically done is an index that just includes minimal information, id, name is probably sufficient. Then you do a subsequent call for the cards you want complete detail about. Which you can already do with the existing API. You could also make index only give back minimal information unless a flag is passed to return all or return the specific fields like you already do.

ontehfritz commented 10 years ago

There is field select on the Get all card methods. It can be implemented for the others as well. I am not a mobile developer, or have much experience developing for mobile devices. So it is good to know the constraints and bottle necks when it comes to mobile dev, especially if they are going to pull request live from api.mtgdb.info instead of storing the data locally.

ontehfritz commented 10 years ago

For now JSON will be the only format.