Simple Todo List
A Simple todo list
Use the Content-Type header to define the payload content e.g.
Content-Type: application/json
Set Content-Type header to application/xml if you want to send in XML.
Content-Type: application/xml
You can control the returned data format by setting the Accept header
You can request XML response by setting the Accept header.
i.e. for XML use
Accept: application/xml
You can request JSON response by setting the Accept header.
i.e. for JSON use
Accept: application/json
Some requests can be filtered by adding query params of fieldname=value. Where only matching items will be returned.
e.g. /thing?size=2&status=true
Model
Things
todo
Fields:Fieldname | Type | Validation |
id | AUTO_INCREMENT |
|
Example: "83" | ||
title | STRING |
|
Example: "A title" | ||
doneStatus | BOOLEAN |
|
Example: "false" | ||
description | STRING |
|
Example: "my description" |
Example JSON Output from API calls
{
"todos": [
{
"id": 83,
"title": "A title",
"doneStatus": false,
"description": "my description"
}
]
}
Example XML Output from API calls
<todos>
<todo>
<doneStatus>false</doneStatus>
<description>my description</description>
<id>83</id>
<title>A title</title>
</todo>
</todos>
Example JSON Input to API calls
{
"title": "A title",
"doneStatus": false,
"description": "my description"
}
Example XML Input to API calls
<todo>
<doneStatus>false</doneStatus>
<description>my description</description>
<title>A title</title>
</todo>
API
The API takes body with objects using the field definitions and examples shown in the model.
End Points
/todos
e.g. /todos
This endpoint can be filtered with fields as URL Query Parameters.
e.g. /todos?description=my%20description
-
GET /todos
- return all the instances of todo
-
HEAD /todos
- headers for all the instances of todo
-
POST /todos
- we should be able to create todo without a ID using the field values in the body of the message. A maximum of 20 todos is allowed.
-
OPTIONS /todos
- show all Options for endpoint of todos
/todos/:id
e.g. /todos/:id
-
GET /todos/:id
- return a specific instances of todo using a id
-
HEAD /todos/:id
- headers for a specific instances of todo using a id
-
POST /todos/:id
- amend a specific instances of todo using a id with a body containing the fields to amend
-
PUT /todos/:id
- amend a specific instances of todo using a id with a body containing the fields to amend
-
DELETE /todos/:id
- delete a specific instances of todo using a id
-
OPTIONS /todos/:id
- show all Options for endpoint of todos/:id
/challenger/:guid
e.g. /challenger/:guid
-
GET /challenger/:guid
- Get a challenger in Json format to allow continued tracking of challenges.
-
PUT /challenger/:guid
- Restore a saved challenger matching the supplied X-CHALLENGER guid to allow continued tracking of challenges.
/challenger
e.g. /challenger
-
POST /challenger
- Create a challenger using the X-CHALLENGER guid header.
/challenger/database/:guid
e.g. /challenger/database/:guid
-
GET /challenger/database/:guid
- Get the todo data for the supplied X-CHALLENGER guid to allow later restoration of the todos.
-
PUT /challenger/database/:guid
- Restore a saved set of todos for a challenger matching the supplied X-CHALLENGER guid.
/challenges
e.g. /challenges
-
GET /challenges
- Get list of challenges and their completion status
-
HEAD /challenges
- Headers for list of challenges endpoint
-
OPTIONS /challenges
- Options for list of challenges endpoint
/heartbeat
e.g. /heartbeat
-
GET /heartbeat
- Is the server running? YES 204
-
HEAD /heartbeat
- Headers for heartbeat endpoint
-
OPTIONS /heartbeat
- Options for heartbeat endpoint
/secret/token
e.g. /secret/token
-
POST /secret/token
- POST /secret/token with basic auth to get a secret/token to use as X-AUTH-TOKEN header, to allow access to the /secret/note end points.
/secret/note
e.g. /secret/note
-
GET /secret/note
- GET /secret/note with X-AUTH-TOKEN to return the secret note for the user.
-
POST /secret/note
- POST /secret/note with X-AUTH-TOKEN, and a payload of `{'note':'contents of note'}` to amend the contents of the secret note.