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
Simple API Mode
A simple API, no auth protection so you can add and delete what you want in a multi-user mode.
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.
Model
Things
item
Fields:| Fieldname | Type | Description |
| id | AUTO_INCREMENT |
|
| Example: "28" | ||
| type | ENUM |
|
| Example: "blu-ray" | ||
| isbn13 | STRING |
|
| Example: "123-4-56-789012-3" | ||
| price | FLOAT |
|
| Example: "97.99" | ||
| numberinstock | INTEGER |
|
| Example: "0" | ||
Example JSON Output from API calls
{
"id": 28,
"type": "blu-ray",
"isbn13": "123-4-56-789012-3",
"price": 97.99,
"numberinstock": 0
}
Example XML Output from API calls
<item>
<price>97.99</price>
<numberinstock>0</numberinstock>
<isbn13>123-4-56-789012-3</isbn13>
<id>28</id>
<type>blu-ray</type>
</item>
Example JSON Input to API calls
{
"id": 1,
"type": "blu-ray",
"isbn13": "123-4-56-789012-3",
"price": 97.99,
"numberinstock": 0
}
Example XML Input to API calls
<item>
<price>97.99</price>
<numberinstock>0</numberinstock>
<isbn13>123-4-56-789012-3</isbn13>
<id>1</id>
<type>blu-ray</type>
</item>
API
The API takes body with objects using the field definitions and examples shown in the model.
End Points
/simpleapi/items
e.g. /simpleapi/items
This endpoint can be filtered with fields as URL Query Parameters.
e.g. /simpleapi/items?type=book
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. /simpleapi/items?_sortBy=+id
-
GET /simpleapi/items
- return all the instances of item
-
QUERY /simpleapi/items
- query all the instances of item 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 /simpleapi/items
- headers for all the instances of item
-
POST /simpleapi/items
- we should be able to create item without a ID using the field values in the body of the message. A maximum of 100 items is allowed.
-
OPTIONS /simpleapi/items
- show all Options for endpoint of /simpleapi/items
/simpleapi/items/:id
e.g. /simpleapi/items/:id
-
GET /simpleapi/items/:id
- return a specific instances of item using a id
-
HEAD /simpleapi/items/:id
- headers for a specific instances of item using a id
-
POST /simpleapi/items/:id
- amend a specific instances of item using a id with a body containing the fields to amend
-
PUT /simpleapi/items/:id
- amend a specific instances of item using a id with a body containing the fields to amend
-
DELETE /simpleapi/items/:id
- delete a specific instances of item using a id
-
OPTIONS /simpleapi/items/:id
- show all Options for endpoint of /simpleapi/items/:id
-
PATCH /simpleapi/items/:id
- patch a specific instance of item with a body containing the patch details
/simpleapi/randomisbn
e.g. /simpleapi/randomisbn
-
GET /simpleapi/randomisbn
- return a random ISBN that can be used for testing purposes with the Simple API.
- 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