Skip to content

Schema HTTP Actions

Greg Malcolm edited this page Feb 8, 2016 · 19 revisions

Currently most of the resources available via the API confirm to basic CRUD patterns

GET "index" urls

Example:

GET /api/v2/world_surveys/

Page sizes are currently 500 items (we are probably going to shorten them at some point)

Example through CURL (runnable in git bash or unix):

curl -i -H "Content-Type: application/json" http://ed-materializer-env.elasticbeanstalk.com/api/v2/world_surveys/\?page=1

Query Param Options

Standard paging stuff

  • page
  • per_page (currently defaults to 500)

Filtering attributes vary. These are common options:

  • system
  • commander
  • updater
  • world
  • updated_before
  • updated_after

Examples:

Filter on commander and world:

curl -i -H "Content-Type: application/json" http://ed-materializer-env.elasticbeanstalk.com/api/v2/world_surveys/?commander=marlon%20blake&world=A%205&page=1

Find all records after 30th Dec 2015

curl -i -H "Content-Type: application/json" https://ed-materializer.herokuapp.com/api/v1/world_surveys/?updated_after=2015-12-30

GET "show" with ID urls

Example:

GET /api/v2/world_surveys/:id

Currently uses numerical ids

This returns the record where id=1

curl -i -H "Content-Type: application/json" https://ed-materializer.herokuapp.com/api/v2/world_surveys/1

POST record inserts

Note: Requires an access_token. See Auth

Example:

POST /api/v1/world_surveys

Curl example:

Note: change uid, access_token and client, to use your own auth tokens):

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H "access_token: ACCESS_TOKEN" -H "client: CLIENT" -H "uid: jenny@example.com" -X POST -d '{"world_survey":{"system": "test", "commander": "test", "world": "A 1", "iron": "true"}}' https://ed-materializer.herokuapp.com/api/v1/world_surveys

Clone this wiki locally