Skip to content

Schema HTTP Actions

Greg Malcolm edited this page Mar 30, 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/stars/\?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 updater and world:

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

Find all records after 30th Dec 2015

curl -i -H "Content-Type: application/json" https://ed-materializer.herokuapp.com/api/v2/stars/?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=600

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

POST record inserts

Note: Requires an access_token. See Auth

Example:

POST /api/v2/worlds

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: [email protected]" -X POST -d '{"world":{"system": "test", "updater": "test", "world": "A", "gravity": "1.3"}}' https://ed-materializer.herokuapp.com/api/v2/worlds

NOTE: Special "application" role users such as EDDiscovery will also need to submit a "user" param on the root level specifiying the commander name. This is a required field. EG:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H "access_token: ACCESS_TOKEN" -H "client: CLIENT" -H "uid: [email protected]" -X POST -d '{"user", "Jameson", "world":{"system": "test", "updater": "test", "world": "A", "gravity": "1.3"}}' https://ed-materializer.herokuapp.com/api/v2/worlds

PATCH single record update

Note: Requires an access_token. See Auth

`PATCH /api/v2/worlds/:id'

This example assumes we want to change the record where id=4:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H "access_token: ACCESS_TOKEN" -H "client: CLIENT" -H "uid: [email protected]" -X PATCH -d '{"world_survey":{"system": "test2", "updater": "test", "world": "A 1", "gravity": "3.3"}}' https://ed-materializer.herokuapp.com/api/v2/worlds/4

If the return code is 204 then you were successful

NOTE: Special "application" role users such as EDDiscovery will also need to submit a "user" param on the root level specifiying the commander name. This is a required field.

DELETE single record

Note: Requires an access_token. See Auth

DELETE /api/v2/worlds/:id

This example assumes we want to remove the record where id=4:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -H "access_token: ACCESS_TOKEN" -H "client: CLIENT" -H "uid: [email protected]" -X DELETE https://ed-materializer.herokuapp.com/api/v2/worlds/4

NOTE: Special "application" role users such as EDDiscovery will also need to submit a "user" param on the root level specifiying the commander name. This is a required field.

Clone this wiki locally