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)
- The base url http://ropensci.org/csv-to-api/index.php
- Then tack on the Dryad url http://datadryad.org/bitstream/handle/10255/dryad.34075/Evolution%2011-0308%20Pryke%20et%20al.%202011a.csv?sequence=1 (you can find this URL by right clicking on the csv file link on Dryad's site)
- Then specify the source format, which is csv source_format=csv
- Specify the output format format=json (could also be html, json, xml, default is json)
- Then you can query on columns in the actual csv file. For example, there is a column called Clutch that has possible values Y and N Clutch=N
- The full URL http://ropensci.org/csv-to-api/index.php?source=http://datadryad.org/bitstream/handle/10255/dryad.34075/Evolution%2011-0308%20Pryke%20et%20al.%202011a.csv?sequence=1&source_format=csv&format=json&Clutch=N
{
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...
source
: the URL to the source CSVsource_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 callbacksort
: 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