Example API

A schema for a small example API.

App

An app is a program to be deployed.

Properties

POST /apps

Create a new app.

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 /apps/:id

Delete an existing app.

DELETE /apps/01234567-89ab-cdef-0123-456789abcdef HTTP/1.1
Host: api.example.com
HTTP/1.1 204 No Content

GET /apps/:id

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"
    }
  ]
}

GET /apps

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"
      }
    ]
  }
]

PATCH /apps/:id

Update an existing app.

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"
    }
  ]
}

POST /apps/:id/files

Upload an attachment file for an app

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"
    }
  ]
}

Recipe

Properties

GET /recipes

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"
    }
  }
]

User

Properties