REST API version 1

From Lifeguide Wiki
Revision as of 11:46, 31 May 2018 by DonCruickshank (talk | contribs) (Created page with "LifeGuide provides a REST API to manage parts of an intervention. This API is a work-in-progress and so will not be complete. __TOC__ = Intervention Users (participants) = ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

LifeGuide provides a REST API to manage parts of an intervention. This API is a work-in-progress and so will not be complete.

Intervention Users (participants)

List Intervention Users

Example cURL command:

curl -i -X GET \
    --header "Authorization: Token cOrNDlXtHTH17lFYUF5ixo8e5w7myXxM" \
    "https://beta.lifeguideonline.org/api/v1/intervention_user?per_page=5"

Example response:

HTTP/1.1 200 OK
Date: Mon, 01 Jan 2018 00:00:00 GMT
Server: Apache-Coyote/1.1
X-Total: 13
Link: <https://beta.lifeguideonline.org/api/v1/intervention_user?page=2&per_page=5>; rel="next"
Content-Type: application/json;charset=utf-8
Transfer-Encoding: chunked

[{"id":1,"enabled":true,"username":"user1","uri":"https://beta.lifeguideonline.org/api/v1/intervention_user/1"},
 {"id":2,"enabled":true,"username":"user2","uri":"https://beta.lifeguideonline.org/api/v1/intervention_user/2"},
 {"id":3,"enabled":true,"username":"user3","uri":"https://beta.lifeguideonline.org/api/v1/intervention_user/3"},
 {"id":4,"enabled":true,"username":"user4","uri":"https://beta.lifeguideonline.org/api/v1/intervention_user/4"},
 {"id":5,"enabled":true,"username":"user5","uri":"https://beta.lifeguideonline.org/api/v1/intervention_user/5"}]

Create an Intervention User

Example cURL command:

curl -i -X POST \
    --header "Content-Type: application/json" \
    --header "Authorization: Token cOrNDlXtHTH17lFYUF5ixo8e5w7myXxM" \
    --data '{"username"="john.smith","password"="123456"}' \
    "https://beta.lifeguideonline.org/api/v1/intervention_user"

Example response:

HTTP/1.1 201 Created
Date: Mon, 01 Jan 2018 00:00:00 GMT
Server: Apache-Coyote/1.1
Content-Location: https://beta.lifeguideonline.org/api/v1/intervention_user/20
Content-Type: text/html;charset=utf-8
Transfer-Encoding: chunked

Delete an Intervention User

Example cURL command:

curl -i -X DELETE \
    --header "Authorization: Token cOrNDlXtHTH17lFYUF5ixo8e5w7myXxM" \
    "https://beta.lifeguideonline.org/api/v1/intervention_user/20"

Example response:

HTTP/1.1 204 No Content
Date: Mon, 01 Jan 2018 00:00:00 GMT
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Length: 0