-
Notifications
You must be signed in to change notification settings - Fork 0
Schema HTTP Actions
Currently most of the resources available via the API confirm to basic CRUD patterns. When testing out crud operations it may be worth considering testing with the current test server:
http//ed-materializer.herokuapp.com/
When you've tested with the test surver, you can then work with the production server:
This server will be used for the examples here to avoid accidents.
The API schema is in JSON API format:
Example:
GET /api/v4/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.herokuapp.com/api/v4/stars/\?page=1
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.herokuapp.com/api/v4/stars/?updater=marlon%20blake&world=A&page=1
Find all records after 30th Dec 2015
curl -i -H "Content-Type: application/json" http//ed-materializer.herokuapp.com/api/v4/stars/?updated_after=2015-12-30
Example:
GET /api/v4/world_surveys/:id
Currently uses numerical ids
This returns the record where id=600
curl -i -H "Content-Type: application/json" http//ed-materializer.herokuapp.com/api/v4/stars/600
Note: Requires an access_token. See Auth
Example:
POST /api/v4/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 '{"data":{"type": "worlds", "attributes": {"system-name": "test", "updater": "test", "world": "A", "gravity": "1.3"}}}' http//ed-materializer.herokuapp.com/api/v4/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", "data":{"type": "worlds", "attributes": {"system-name": "test", "updater": "test", "world": "A", "gravity": "1.3"}}}' http//ed-materializer.herokuapp.com/api/v4/worlds
Note: Requires an access_token. See Auth
`PATCH /api/v4/worlds/:id'
or if you can't use PATCH for some reason: `PUT /api/v4/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 '{"data":{"id": 4, "type": "worlds", "attributes": {"system-name": "test2", "updater": "test", "world": "A 1", "gravity": "3.3"}}}' http//ed-materializer.herokuapp.com/api/v4/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.
Note: Requires an access_token. See Auth
DELETE /api/v4/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/v4/worlds/4
NOTE: Special "application" role users such as EDDiscovery will also need to submit a "user" param on the root level specifying the commander name. This is a required field.