An open source CRUD REST API to build demos on, test stuff against or just play around with.
For other projects, I was using restful-api.dev to build demos or tests on. But recently, this page proved to be somewhat inconsistent and unreliable, so I wanted to build something hosted on Vercel using Upstash as Redis Store, so that it should be a pretty reliable alternative.
The live API root endpoint is as following.
https://example-rest-api.vercel.app
The API accepts request payloads as application/json
and responses are encoded in application/json
.
Warning
Created objects are not persistent nor protected. Objects are usually automatically removed 24 hours after creation or modification. Objects and collection are not proof against modification by unauthorized individuals.
type CollectionRequest = {
name: string;
};
type CollectionResponse = {
id: string;
created_at: string; // Format: RFC3339
name: string;
};
type ObjectRequest = {
name: string;
data: { [key: string]: any };
};
type ObjectResponse = {
id: string;
created_at: string; // Format: RFC3339
name: string;
data: { [key: string]: any };
};
Create a new collection.
POST /api/collections
CollectionRequest
Example:
{
"name": "my games"
}
CollectionResponse
Example:
{
"id": "chf13ur2iejc717547r0",
"created_at": "2023-05-12T10:16:27.319442753+00:00",
"name": "my games"
}
Retrieve information about a collection by ID.
GET /api/collections/:collectionid
CollectionResponse
Example:
{
"id": "chf13ur2iejc717547r0",
"created_at": "2023-05-12T10:16:27.319442753+00:00",
"name": "my games"
}
Update a collection.
POST /api/collections/:collectionid
CollectionRequest
Example:
{
"name": "My Games"
}
CollectionResponse
Example:
{
"id": "chf13ur2iejc717547r0",
"created_at": "2023-05-12T10:16:27.319442753+00:00",
"name": "My Games"
}
Delete a collection by ID.
DELETE /api/collections/:collectionid
Create a new object in a collection.
POST /api/collections/:collectionid/objects
ObjectRequest
Example:
{
"name": "Cyberpunk 2077",
"data": {
"publisher": "CD PROJECT RED",
"developer": "CD PROJECT RED",
"released": "2020-12-10T00:00:00Z",
"tags": ["Cyberpunk", "Open World", "RPG", "Sci-fi"],
"age_rating": "18"
}
}
ObjectResponse
Example:
{
"id": "chf15eacaqvs715h7ae0",
"created_at": "2023-05-12T10:19:37.971387217+00:00",
"name": "Cyberpunk 2077",
"data": {
"tags": [
"Cyberpunk",
"Open World",
"RPG",
"Sci-fi"
],
"age_rating": "18",
"publisher": "CD PROJECT RED",
"developer": "CD PROJECT RED",
"released": "2020-12-10T00:00:00Z"
}
}
Retrieve an object from a collection by ID.
GET /api/collections/:collectionid/objects/:objectid
ObjectResponse
Example:
{
"id": "chf15eacaqvs715h7ae0",
"created_at": "2023-05-12T10:19:37.971387217+00:00",
"name": "Cyberpunk 2077",
"data": {
"tags": [
"Cyberpunk",
"Open World",
"RPG",
"Sci-fi"
],
"age_rating": "18",
"publisher": "CD PROJECT RED",
"developer": "CD PROJECT RED",
"released": "2020-12-10T00:00:00Z"
}
}
Update an object in a collection.
POST /api/collections/:collectionid/objects/:objectid
ObjectRequest
Example:
{
"name": "Cyberpunk 2077",
"data": {
"publisher": "CD PROJECT RED",
"developer": "CD PROJECT RED",
"released": "2020-12-10T00:00:00Z",
"tags": ["Cyberpunk", "Open World", "RPG", "Sci-fi", "Explicit"],
"age_rating": "18"
}
}
Delete an object in a collection by ID.
DELETE /api/collections/:collectionid/objects/:objectid
© 2023 Ringo Hoffmann.
Covered by the MIT License.