Docks

Docks API

Authentication

Tokens

Token Payload

{
  "username": "<username>"
}
POST http://127.0.0.1:8080/api/auth/token
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "username": "admin",
  "password": "admin"
}
Responses200401

Valid credentials

Headers
Content-Type: application/json
Body
{
  "jwt": "8HhsbJ86AFjjhzj.ASKI9ghA7778ah.blahlbalhlb"
}

Invalid credentials

Headers
Content-Type: application/json
Body
{
  "message": "Invalid username or password"
}

Request new JWT
POST/api/auth/token

Request a new JWT for use in Authenticated requests


User Management

User Collection

GET http://127.0.0.1:8080/users
Responses200
Headers
Content-Type: application/json
Body
{
  "data": [
    {
      "username": "bob"
    },
    {
      "username": "john"
    }
  ]
}

Get All Users
GET/users

Returns all users in the database.


POST http://127.0.0.1:8080/users
Requestsexample 1
Headers
Content-Type: application/json
Body
{
    "username": "fred",
    "password": "pass",
}
Responses200409
This response has no content.

Username already exists

Create User
POST/users

Create a new user


User

PUT http://127.0.0.1:8080/users/username
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "password": "BetterPass333"
}
Responses200404
This response has no content.

User does not exist

Update User
PUT/users/{username}

URI Parameters
HideShow
username
string (required) 

The username used to login


DELETE http://127.0.0.1:8080/users/username
Responses200404
This response has no content.

User does not exist

Delete User
DELETE/users/{username}

Delete a user from the system

URI Parameters
HideShow
username
string (required) 

The username used to login


Docker Stacks

Stack Collection

GET http://127.0.0.1:8080/stacks
Responses200
Headers
Content-Type: application/json
Body
{
  "data": [
    {
      "stackName": "docks-api",
      "servicesCount": 3
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "data": {
      "type": "array"
    }
  }
}

List Stacks
GET/stacks

Get all stacks running in the Swarm


POST http://127.0.0.1:8080/stacks
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "stackName": "docks-api",
  "stackFile": "IyBEZXBsb3kgdG...V09SRD1leGFtcGxl"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "stackName": {
      "type": "string",
      "description": "Unique stack name"
    },
    "stackFile": {
      "type": "string",
      "description": "Base64 encoded docker-compose file"
    }
  },
  "required": [
    "stackName",
    "stackFile"
  ]
}
Responses200409

Stack created successfully

Stack name already exists

Deploy New Stack
POST/stacks

Deploy a new stack to the Swarm. The stack name should not exist


Stack

PUT http://127.0.0.1:8080/stacks/stackName
Requestsexample 1
Headers
Content-Type: application/json
Body
{
  "stackFile": "IyBEZXBsb3kgdG...V09SRD1leGFtcGxl"
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "stackFile": {
      "type": "string",
      "description": "Base64 encoded docker-compose file"
    }
  },
  "required": [
    "stackFile"
  ]
}
Responses200404

Stack updated successfully

Stack name does not exist

Update Existing Stack
PUT/stacks/{stackName}

URI Parameters
HideShow
stackName
string (required) 

The unique stack name


DELETE http://127.0.0.1:8080/stacks/stackName
Responses200404
This response has no content.

Stack does not exist

Remove Stack
DELETE/stacks/{stackName}

URI Parameters
HideShow
stackName
string (required) 

The unique stack name


GET http://127.0.0.1:8080/stacks/stackName/services
Responses200
Headers
Content-Type: application/json
Body
{
  "data": [
    {
      "ID": "",
      "Version": {},
      "CreatedAt": "",
      "UpdatedAt": "",
      "Spec": {},
      "Endpoint": {}
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "data": {
      "type": "array"
    }
  }
}

Get Services in Stack
GET/stacks/{stackName}/services

Returns an array of Services associated with the given stack from Docker API.

The Schema for the service is defined in the Docker API, the Schema displayed here is only for demonstration purposes.

URI Parameters
HideShow
stackName
string (required) 

The unique stack name


GET http://127.0.0.1:8080/stacks/stackName/tasks
Responses200404
Headers
Content-Type: application/json
Body
{
  "data": [
    {
      "ID": "",
      "Version": {},
      "CreatedAt": "",
      "UpdatedAt": "",
      "Name": "",
      "Labels": {},
      "Spec": {}
    }
  ]
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ID": {
            "type": "string",
            "enum": [
              ""
            ]
          },
          "Version": {
            "type": "object",
            "properties": {},
            "additionalProperties": false
          },
          "CreatedAt": {
            "type": "string",
            "enum": [
              ""
            ]
          },
          "UpdatedAt": {
            "type": "string",
            "enum": [
              ""
            ]
          },
          "Name": {
            "type": "string",
            "enum": [
              ""
            ],
            "description": "Name of the task."
          },
          "Labels": {
            "type": "object",
            "properties": {},
            "additionalProperties": false,
            "description": "User defined key/value metadata."
          },
          "Spec": {
            "type": "object",
            "properties": {},
            "additionalProperties": false,
            "description": "User modifiable task configuration."
          }
        },
        "required": [
          "ID",
          "Version",
          "CreatedAt",
          "UpdatedAt",
          "Name",
          "Labels",
          "Spec"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "data"
  ]
}

Stack does not exist

Get Tasks in Stack
GET/stacks/{stackName}/tasks

Returns an array of Tasks associated with the given stack.

The Schema for the tasks is defined in the Docker API, the Schema displayed here is only for demonstration purposes.

URI Parameters
HideShow
stackName
string (required) 

The unique stack name


GET http://127.0.0.1:8080/stacks/stackName/stackfile
Responses200404
Headers
Content-Type: application/json
Body
{
  "data": {
    "stackFile": "IyBEZXBsb3kgdG...V09SRD1leGFtcGxl"
  }
}
Schema
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "stackFile": {
          "type": "string",
          "enum": [
            "IyBEZXBsb3kgdG...V09SRD1leGFtcGxl"
          ],
          "description": "Base64 encoded docker-compose file"
        }
      },
      "required": [
        "stackFile"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "data"
  ]
}

Stack does not exist

Get Stackfile
GET/stacks/{stackName}/stackfile

Returns the Base64 encoded docker-compose file generated from the current Docker Swarm state

URI Parameters
HideShow
stackName
string (required) 

The unique stack name


Docker

Proxy

All requests to the /docker endpoint will be forwarded to the Docker API

GET http://127.0.0.1:8080/docker/services
Requestsexample 1
Headers
Authorization: Bearer <jwt>
Responses200406500
Headers
Content-Type: application/json
This response has no content.
This response has no content.

List Services
GET/docker/services


Generated by aglio on 19 Jul 2018