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: "88" | ||
| title | STRING |
|
| Example: "A title" | ||
| doneStatus | BOOLEAN |
|
| Example: "false" | ||
| description | STRING |
|
| Example: "my description" | ||
Example JSON Output from API calls
{
"todos": [
{
"id": 88,
"title": "A title",
"doneStatus": false,
"description": "my description"
}
]
}
Example XML Output from API calls
<todos>
<doneStatus>false</doneStatus>
<description>my description</description>
<id>88</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>
secrettoken
Fields:| Fieldname | Type | Description |
| id | STRING |
|
| Example: "se cillum dolore eua" | ||
| token | STRING |
|
| Example: "ad minim veniam, qua" | ||
| View | Request Fields | Response Fields | Input Allowed Fields |
| SecretTokenResponse | token | token | id, token |
Example JSON Output from API calls
{
"secrettokens": [
{
"id": "se cillum dolore eua",
"token": "ad minim veniam, qua"
}
]
}
Example XML Output from API calls
<secrettokens>
<id>se cillum dolore eua</id>
<token>ad minim veniam, qua</token>
</secrettokens>
Example JSON Input to API calls
{
"id": "se cillum dolore eua",
"token": "ad minim veniam, qua"
}
Example XML Input to API calls
<secrettoken>
<id>se cillum dolore eua</id>
<token>ad minim veniam, qua</token>
</secrettoken>
secretnote
Fields:| Fieldname | Type | Description |
| id | STRING |
|
| Example: "eniam, quis nostruda" | ||
| note | STRING |
|
| Example: "dent, sunt in culpaa" | ||
| View | Request Fields | Response Fields | Input Allowed Fields |
| SecretNoteResponse | note | note | id, note |
Example JSON Output from API calls
{
"secretnotes": [
{
"id": "eniam, quis nostruda",
"note": "dent, sunt in culpaa"
}
]
}
Example XML Output from API calls
<secretnotes>
<note>dent, sunt in culpaa</note>
<id>eniam, quis nostruda</id>
</secretnotes>
Example JSON Input to API calls
{
"id": "eniam, quis nostruda",
"note": "dent, sunt in culpaa"
}
Example XML Input to API calls
<secretnote>
<note>dent, sunt in culpaa</note>
<id>eniam, quis nostruda</id>
</secretnote>
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?title=A%20title
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/secret/token
e.g. /api/secret/token
-
GET /api/secret/token
- GET /api/secret/token with basic auth to get an X-AUTH-TOKEN header and token response body for 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.
-
HEAD /api/secret/note
- map /api/secret/note to fixed secretnote instance note
-
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.
/api/secret/token
e.g. /api/secret/token
-
OPTIONS /api/secret/token
- return supported verbs for fixed route /api/secret/token
/api/secret/note
e.g. /api/secret/note
-
OPTIONS /api/secret/note
- return supported verbs for fixed route /api/secret/note
/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
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