{"action":"created","issue":{"url":"https://api.github.com/repos/Bookworm-project/BookwormAPI/issues/15","labels_url":"https://api.github.com/repos/Bookworm-project/BookwormAPI/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/Bookworm-project/BookwormAPI/issues/15/comments","events_url":"https://api.github.com/repos/Bookworm-project/BookwormAPI/issues/15/events","html_url":"https://github.com/Bookworm-project/BookwormAPI/issues/15","id":70750651,"number":15,"title":"Add `format` as top-level parameter?","user":{"login":"bmschmidt","id":1110758,"avatar_url":"https://avatars.githubusercontent.com/u/1110758?v=3","gravatar_id":"","url":"https://api.github.com/users/bmschmidt","html_url":"https://github.com/bmschmidt","followers_url":"https://api.github.com/users/bmschmidt/followers","following_url":"https://api.github.com/users/bmschmidt/following{/other_user}","gists_url":"https://api.github.com/users/bmschmidt/gists{/gist_id}","starred_url":"https://api.github.com/users/bmschmidt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmschmidt/subscriptions","organizations_url":"https://api.github.com/users/bmschmidt/orgs","repos_url":"https://api.github.com/users/bmschmidt/repos","events_url":"https://api.github.com/users/bmschmidt/events{/privacy}","received_events_url":"https://api.github.com/users/bmschmidt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Bookworm-project/BookwormAPI/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-24T17:43:48Z","updated_at":"2015-04-28T19:05:10Z","closed_at":null,"body":"Currently, a top level API call parameter is `method`, but it's doing two different types of things.\r\n\r\nThe first is specifying what kind of call the user is making; returning search results, getting a list of available fields for a given bookworm, or returning data for a plot.\r\n\r\nThe second is specifying the format for the returned data to be in: TSV, JSON, a pickled pandas frame, etc. (Not really etc., but it could be.\r\n\r\nCurrently, those second formats are all direct `method` calls that only work for returning data. But logically, these are different **types** of operations; you might want a csv of search results or available fields, but currently we only return JSON.\r\n\r\nCurrently, this is illogical but not a huge problem. The one issue I see is that if users want to download a list of search results, currently we can only return it to them as JSON; but ordinary people don't know what to do with a JSON array of HTML strings, but we might be able to usefully reformat the results as a CSV file of just the search text.\r\n\r\nThe place this will really break down, for example, is if we were to allow JSONP calls for any webserver to make cross-domain calls. JSONP should be a format just like JSON; but for a bookworm to work, you'd need to be able to return all three types of methods, not just the data, as JSONP.\r\n\r\nI imagine this would default to JSON, so most current queries would keep running normally as-is; we might need a little back-compatibility glue to restructure queries of the form `{\"method\":\"return_tsv\",...}` to `{\"method\":\"data\",\"format\":\"tsv\",...}`.\r\n\r\nAnd of course, there's the question of what the standard method would be called. I guess I'm thinking \"data.\" "},"comment":{"url":"https://api.github.com/repos/Bookworm-project/BookwormAPI/issues/comments/97171826","html_url":"https://github.com/Bookworm-project/BookwormAPI/issues/15#issuecomment-97171826","issue_url":"https://api.github.com/repos/Bookworm-project/BookwormAPI/issues/15","id":97171826,"user":{"login":"organisciak","id":58351,"avatar_url":"https://avatars.githubusercontent.com/u/58351?v=3","gravatar_id":"","url":"https://api.github.com/users/organisciak","html_url":"https://github.com/organisciak","followers_url":"https://api.github.com/users/organisciak/followers","following_url":"https://api.github.com/users/organisciak/following{/other_user}","gists_url":"https://api.github.com/users/organisciak/gists{/gist_id}","starred_url":"https://api.github.com/users/organisciak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/organisciak/subscriptions","organizations_url":"https://api.github.com/users/organisciak/orgs","repos_url":"https://api.github.com/users/organisciak/repos","events_url":"https://api.github.com/users/organisciak/events{/privacy}","received_events_url":"https://api.github.com/users/organisciak/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T19:05:10Z","updated_at":"2015-04-28T19:05:10Z","body":"This is a good idea.\r\n\r\nThe kink I've run into is that I tried to [force `return_json`](https://github.com/organisciak/BookwormPython/blob/master/bwypy/bwypy.py#L84) for a script that I use, but it conflicted with `method:'returnPossibleFields'`. "}}