REM Server - a REST Mockup API
This is a mockup server for development of applications working with a REST API. The server responds to any API endpoint, stores data and changes to the data in the user session.
The server has a default dataset for the endpoint api/users
.
You can add your own datasets and work with them through api/[datasets]
.
Try it
You can try out the pre-populated dataset users
.
API
Get the dataset
Get the full dataset, or a part of it.
GET /api/[dataset] GET /api/users
Results.
{
"data": [],
"offset": 0,
"limit": 25,
"total": 0
}
{
"data": [
{
"id": "1",
"firstName": "Phuong",
"lastName": "Allison"
},
...
],
"offset": 0,
"limit": 25,
"total": 12
}
Optional query string parameters.
offset
defaults to 0.limit
defaults to 25.
GET /api/users?offset=0&limit=25
Get one entry
Get one entry based on its id.
GET /api/users/7
Results.
{
"id": "7",
"firstName": "Etha",
"lastName": "Nolley"
}
Create a new entry
Add a new entry to a dataset, create the dataset if it does not exists and will add a id to the entry.
POST /api/[dataset] {"some": "thing"} POST /api/users {"firstName": "Mikael", "lastName": "Roos"}
Results.
{
"some": "thing",
"id": 1
}
{
"firstName": "Mikael",
"lastName": "Roos",
"id": 13
}
Upsert/replace a entry
Upsert (insert/update) or replace a entry, create the dataset if it does not exists.
PUT /api/[dataset]/1 {"id": 1, "other": "thing"} PUT /api/users/13 {"id": 13, "firstName": "MegaMic", "lastName": "Roos"}
The value in the id-field is updated to match the one from the PUT request value.
Results.
{
"other": "thing",
"id": 1
}
{
"id": 13,
"firstName": "MegaMic",
"lastName": "Roos"
}
Delete a entry
Delete a entry.
DELETE /api/[dataset]/1 DELETE /api/users/13
The result will always be null
.
Other REM servers
There are more servers doing the same thing.
Source
The source for the actual REM server is an Anax module canax/remserver.
The source for the website rem.dbwebb.se is available in GitHub canax/remserver-website.