A schema for a small example API.
An app is a program to be deployed.
"01234567-89ab-cdef-0123-456789abcdef"
"example"
/^[a-z][a-z0-9-]{3,50}$/
false
nil
Create a new app.
"example"
/^[a-z][a-z0-9-]{3,50}$/
POST /apps HTTP/1.1
Content-Type: application/json
Host: api.example.com
{
"name": "example"
}
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"name": "example",
"private": false,
"deleted_at": null,
"user_ids": [
1
],
"users": [
{
"name": "alice"
}
]
}
Delete an existing app.
DELETE /apps/01234567-89ab-cdef-0123-456789abcdef HTTP/1.1
Host: api.example.com
HTTP/1.1 204 No Content
Info for existing app.
GET /apps/01234567-89ab-cdef-0123-456789abcdef HTTP/1.1
Host: api.example.com
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"name": "example",
"private": false,
"deleted_at": null,
"user_ids": [
1
],
"users": [
{
"name": "alice"
}
]
}
List existing apps.
GET /apps HTTP/1.1
Host: api.example.com
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"name": "example",
"private": false,
"deleted_at": null,
"user_ids": [
1
],
"users": [
{
"name": "alice"
}
]
}
]
Update an existing app.
"example"
/^[a-z][a-z0-9-]{3,50}$/
PATCH /apps/01234567-89ab-cdef-0123-456789abcdef HTTP/1.1
Content-Type: application/json
Host: api.example.com
{
"name": "example"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"name": "example",
"private": false,
"deleted_at": null,
"user_ids": [
1
],
"users": [
{
"name": "alice"
}
]
}
Upload an attachment file for an app
"... contents of file ..."
POST /apps/01234567-89ab-cdef-0123-456789abcdef/files HTTP/1.1
Content-Type: multipart/form-data; boundary=---BoundaryX
Host: api.example.com
-----BoundaryX
Content-Disposition: form-data; name="[file]"
... contents of file ...
-----BoundaryX--
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": "01234567-89ab-cdef-0123-456789abcdef",
"name": "example",
"private": false,
"deleted_at": null,
"user_ids": [
1
],
"users": [
{
"name": "alice"
}
]
}
"Sushi"
List recipes
GET /recipes HTTP/1.1
Host: api.example.com
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"name": "Sushi",
"user": {
"name": "alice"
}
}
]
"alice"