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, text/xml, or a model-matching application/*+xml media type if you want to send in XML.
Content-Type: application/xml
Content-Type: text/xml
Content-Type: application/todo+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
Accept: text/xml
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: "65" | ||
| title | STRING |
|
| Example: "A title" | ||
| doneStatus | BOOLEAN |
|
| Example: "false" | ||
| description | STRING |
|
| Example: "my description" | ||
Example JSON Output from API calls
{
"todos": [
{
"id": 65,
"title": "A title",
"doneStatus": false,
"description": "my description"
}
]
}
Example XML Output from API calls
<todos>
<doneStatus>false</doneStatus>
<description>my description</description>
<id>65</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
/api/todos
e.g. /api/todos
This endpoint can be filtered with fields as URL Query Parameters.
e.g. /api/todos?doneStatus=false&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. /api/todos?_sortBy=+id
This endpoint can be paged with the _limit and _offset URL Query Parameters.
e.g. /api/todos?_limit=10&_offset=0
-
GET /api/todos
- return all the instances of todo
-
QUERY /api/todos
- query all the instances of todo using application/x-www-form-urlencoded, application/jsonpath, application/vnd.thingifier.query+json query content
QUERY form content uses Content-Type: application/x-www-form-urlencoded with fields such as title=Task&_sortBy=-id.
QUERY JSONPath content uses Content-Type: application/jsonpath with an expression such as $['todos'][?@['title'] == 'Task'].
QUERY structured JSON content uses Content-Type: application/vnd.thingifier.query+json with a JSON query object.
-
HEAD /api/todos
- headers for all the instances of todo
-
POST /api/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 /api/todos
- show all Options for endpoint of /api/todos
-
PUT /api/todos
- method not allowed
/api/todos/:id
e.g. /api/todos/:id
-
GET /api/todos/:id
- return a specific instances of todo using a id
-
HEAD /api/todos/:id
- headers for a specific instances of todo using a id
-
POST /api/todos/:id
- amend a specific instances of todo using a id with a body containing the fields to amend
-
PUT /api/todos/:id
- amend a specific instances of todo using a id with a body containing the fields to amend
-
DELETE /api/todos/:id
- delete a specific instances of todo using a id
-
OPTIONS /api/todos/:id
- show all Options for endpoint of /api/todos/:id
-
PATCH /api/todos/:id
- patch a specific instance of todo with a body containing the patch details
/api/challenger/:guid
e.g. /api/challenger/:guid
-
GET /api/challenger/:guid
- Get a challenger in Json format to allow continued tracking of challenges.
-
PUT /api/challenger/:guid
- Restore a saved challenger matching the supplied X-CHALLENGER guid to allow continued tracking of challenges.
/api/challenger
e.g. /api/challenger
-
POST /api/challenger
- Create a challenger using the X-CHALLENGER guid header.
/api/challenger/database/:guid
e.g. /api/challenger/database/:guid
-
GET /api/challenger/database/:guid
- Get the todo data for the supplied X-CHALLENGER guid to allow later restoration of the todos.
-
PUT /api/challenger/database/:guid
- Restore a saved set of todos for a challenger matching the supplied X-CHALLENGER guid.
/api/challenges
e.g. /api/challenges
-
GET /api/challenges
- Get list of challenges and their completion status
-
HEAD /api/challenges
- Headers for list of challenges endpoint
-
OPTIONS /api/challenges
- Options for list of challenges endpoint
/api/heartbeat
e.g. /api/heartbeat
-
GET /api/heartbeat
- Is the server running? YES 204
-
HEAD /api/heartbeat
- Headers for heartbeat endpoint
-
OPTIONS /api/heartbeat
- Options for heartbeat endpoint
/api/todos/export
e.g. /api/todos/export
-
GET /api/todos/export
- Export todos using a format query parameter. Supported values are: json, xml, text-xml, csv, text, html, ndjson, jsonl, json-seq, tsv
-
OPTIONS /api/todos/export
- CORS preflight options for exporting todos
/api/secret/token
e.g. /api/secret/token
-
POST /api/secret/token
- POST /api/secret/token with basic auth to get a secret token to use as X-AUTH-TOKEN header, to allow access to the /api/secret/note end points.
-
GET /api/secret/token
- GET /api/secret/token with basic auth to get an X-AUTH-TOKEN header for read-only access to /api/secret/note.
/api/secret/note
e.g. /api/secret/note
-
GET /api/secret/note
- GET /api/secret/note with X-AUTH-TOKEN to return the secret note for the user.
-
POST /api/secret/note
- POST /api/secret/note with X-AUTH-TOKEN, and a payload of `{'note':'contents of note'}` to amend the contents of the secret note.
Find OpenAPI file and OpenAPI Powered Client UIs like Swagger and Scalar here
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