Support this site by joining our Patreon. For as little as $1 a month you receive exclusive ad-free content, ebooks and online training courses. - Learn more
API Challenges 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
Additional response Accept headers are supported.
Accept: text/csv
Accept: text/plain
Accept: text/html
Accept: application/x-ndjson
Accept: application/jsonl
Accept: application/json-seq
Accept: text/tab-separated-values
Some requests can be filtered by adding query params of fieldname=value. Where only matching items will be returned.
Filter conditions can use field=value for equals, field!=value or field!value for not equals, field<value, field>value, field<=value, and field>=value for comparisons, field~=regex for regular expression matches, and field*=wildcard for wildcard matches where * matches many characters and ? matches one character. Multiple query params are combined as AND conditions.
e.g. /thing?size=2&status=true
Some requests can be sorted by adding the _sortBy query param with a field name. Use _sortBy=+field or _sortBy=field for ascending order, and _sortBy=-field for descending order. Multiple fields can be combined with commas, e.g. _sortBy=+field,-other.
Collection requests can be paged with _limit=limit and _offset=offset. Offset is zero-based, the default limit is 10, and the maximum limit is 20.
Model
Things
todo
Fields:| Fieldname | Type | Description |
| id | AUTO_INCREMENT |
|
| Example: "80" | ||
| title | STRING |
|
| Example: "A title" | ||
| doneStatus | BOOLEAN |
|
| Example: "false" | ||
| description | STRING |
|
| Example: "my description" | ||
Example JSON Output from API calls
{
"todos": [
{
"id": 80,
"title": "A title",
"doneStatus": false,
"description": "my description"
}
]
}
Example XML Output from API calls
<todos>
<doneStatus>false</doneStatus>
<description>my description</description>
<id>80</id>
<title>A title</title>
</todos>
Example JSON Input to API calls
{
"id": 1,
"title": "A title",
"doneStatus": false,
"description": "my description"
}
Example XML Input to API calls
<todo>
<doneStatus>false</doneStatus>
<description>my description</description>
<id>1</id>
<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?title=A%20title&description=my%20description
This endpoint can be sorted with the _sortBy URL Query Parameter. Use _sortBy=+field or _sortBy=field for ascending order, and _sortBy=-field for descending order. Multiple fields can be combined with commas, e.g. _sortBy=+field,-other.
e.g. /todos?_sortBy=+id
This endpoint can be paged with the _limit and _offset URL Query Parameters.
e.g. /todos?_limit=10&_offset=0
-
GET /todos
- return all the instances of todo
-
QUERY /todos
- query all the instances of todo using application/x-www-form-urlencoded query content
QUERY content uses Content-Type: application/x-www-form-urlencoded with fields such as title=Task&_sortBy=-id.
-
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
-
PUT /todos
- method not allowed
/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
-
PATCH /todos/:id
- patch a specific instance of todo with a body containing the patch details
/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
/todos/export
e.g. /todos/export
-
GET /todos/export
- Export todos using a format query parameter. Supported values are: json, xml, csv, text, html, ndjson, jsonl, json-seq, tsv
/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.
-
GET /secret/token
- GET /secret/token with basic auth to get an X-AUTH-TOKEN header for read-only access to /secret/note.
/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.
- OpenAPI v 3.0 JSON [standard validation] [download] - [less validation] [download]
- OpenAPI v 3.1 JSON [standard validation] [download] - [less validation] [download]
- OpenAPI v 3.2 JSON [standard validation] [download] - [less validation] [download]
Support this site by joining our Patreon. For as little as $1 a month you receive exclusive ad-free content, ebooks and online training courses. - Learn more