Janitor API

A simple JSON API to interact with Janitor containers, hosts and projects.

Hosts

List hosts

GET /api/hosts

List all cluster hosts owned by the authenticated user.

Response

[
  "host.name"
]

Get a single host

GET /api/hosts/:hostname

Response

{
  "port": "2376"
}

Create a host

POST /api/hosts/:hostname

Create a new host and add it to the cluster.

Input

Content-Type: application/json

{
  "port": "2376"
}

Show host credentials

GET /api/hosts/:hostname/credentials

Show a host's OAuth2 client credentials.

Response

{
  "id": "1234",
  "secret": "123456"
}

Reset host credentials

DELETE /api/hosts/:hostname/credentials

Reset a host's OAuth2 client secret.

Show host version

GET /api/hosts/:hostname/version

Get a single container port

GET /api/hosts/:hostname/:container/:port

Get information about a given Docker container port.

Response

{
  "port": 42000,
  "proxy": "https"
}

User

Get the authenticated user

GET /api/user

Response

{
  "name": "User Name"
}

Update the authenticated user

PATCH /api/user

Update the user's profile information (with JSON Patch).

Input

[
  {
    "op": "add",
    "path": "/name",
    "value": "Different Name"
  }
]

Response

{
  "name": "Different Name"
}

Get all user configurations

GET /api/user/configurations

Response

{
  ".gitconfig": ""
}

Update user configurations

PATCH /api/user/configurations

Update any user configuration file(s) (using JSON Patch).

Input

[
  {
    "op": "add",
    "path": "/.gitconfig",
    "value": "[user]\nname = Janitor"
  }
]

Response

{
  ".gitconfig": "[user]\nname = Janitor"
}

Reset a user configuration

DELETE /api/user/configurations/:file

Reset a user configuration file to its default template value.

Deploy a user configuration

PUT /api/user/configurations/:file

Install or overwrite a configuration file in all the user's containers (any local changes will be lost!)

Response

{
  "message": "Successfully deployed to 0 containers"
}

Admin

List OAuth2 providers

GET /api/admin/oauth2providers

Response

{
  "provider": {
    "id": "1234",
    "secret": "123456",
    "hostname": "host.name"
  }
}

Update an OAuth2 provider

PATCH /api/admin/oauth2providers/:provider

Update an OAuth2 provider configuration (with JSON Patch).

Input

[
  {
    "op": "add",
    "path": "/secret",
    "value": "654321"
  }
]

Response

{
  "id": "1234",
  "secret": "654321",
  "hostname": "host.name"
}