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
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
item
Fields:Fieldname | Type | Validation |
id | AUTO_INCREMENT |
|
Example: "74" | ||
type | ENUM |
|
Example: "dvd" | ||
isbn13 | STRING |
|
Example: "123-4-56-789012-3" | ||
price | FLOAT |
|
Example: "97.99" | ||
numberinstock | INTEGER |
|
Example: "0" |
Example JSON Output from API calls
{
"id": 74,
"type": "dvd",
"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>74</id>
<type>dvd</type>
</item>
Example JSON Input to API calls
{
"type": "dvd",
"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>
<type>dvd</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?numberinstock=0&type=book
-
GET /simpleapi/items
- return all the instances of item
-
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