Skip to content

Instantly share code, notes, and snippets.

@sckott
Last active December 19, 2015 09:59
Show Gist options
  • Save sckott/5937553 to your computer and use it in GitHub Desktop.
Save sckott/5937553 to your computer and use it in GitHub Desktop.
csv to api

Description of csv to api

The code that does the conversion from csv to api is written in php, see here https://github.com/project-open-data/csv-to-api

We just host their code on our hosted server at http://ropensci.org/

Then we build the URL (see bottom of page for possible arguments more generally)

{
29: {
Nest number: "118",
Female morph: "black",
Pre_exp weight: "12.8",
Parental diet: "HQ",
Exp weight: "12.8",
Clutch: "N",
Mean egg size: "214"
},
58: {
Nest number: "113",
Female morph: "red",
Pre_exp weight: "14.2",
Parental diet: "HQ",
Exp weight: "14.2",
Clutch: "N",
Mean egg size: "204"
},
...continued...
Possible parameters to use
  • source: the URL to the source CSV
  • source_format: if the url does not end in .csv, you should specify 'csv' here (to facilitate future functionality)
  • format: the requested return format, either json, xml, or html (default json)
  • callback: if JSON, an optional JSONP callback
  • sort: field to sort by (optional)
  • sort_dir: direction to sort, either asc or desc (default asc)
  • any field(s): may pass any fields as a key/value pair to filter by
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment