API Reference

Konstantin Pastor edited this page Dec 16, 2016 · 5 revisions
Clone this wiki locally

Overview

The LB Origin API exposes operations for managing an enterprise Kubernetes cluster, including security and user management, service deployments, image and source builds, HTTP(s) routing, and project management.

User
Project
Service
Tempalte

User

Object structure

Paramrters:

Name Type Description
id string unique identificator
username string account name
email string account email
gravatar string gravatar hash identificator
balance float information about account balance
organization boolean type account
profile object information about account profile
created string informationwhen about the account was created
updated string information when about the account was last updated

Profile:

Name Type Description
first_name string personal name or organization name if account have organization type
last_name string a surname or family name or not using if account have organization type
company string company name where you working or not using if account have organization type
{
  "id": "7e8514c7-979a-4261-a0b8-9fbe0ea111f9",
  "username": "demo",
  "email": "demo@lastbackend.com",
  "gravatar": "e496e1534d71eabe640f6a0d0440c2c0",
  "balance": 10.0,
  "organization": false,
  "profile": {
    "first_name": "Jacob",
    "last_name": "Wilson",
    "company": "Last.Backend"
  },
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}

Sign up

Request parameters:

Body:

  • username - name that uniquely identifies you in system
  • email - your e-mail address
  • password - a secret word or phrase that must be used to gain admission to a platform

Response parameters:

Status codes:

  • 200 – no error
  • 400 – incorrect json
  • 406 – bad parameter
  • 500 – server error

Errors:

  • INCORRECT_JSON
  • BAD_PARAMETER_USERNAME
  • BAD_PARAMETER_EMAIL
  • BAD_PARAMETER_PASSWORD
  • USERNAME_NOT_UNIQUE
  • EMAIL_NOT_UNIQUE
  • INTERNAL_SERVER_ERROR

REQUEST

POST /user HTTP/1.1
Content-Type: application/json
{
  "username": "demo",
  "email": "demo@lastbackend.com",
  "password": "Aup7TLTJmh"
}

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
{
  "token": "<token>"
}

Sign in

Request parameters:

Body:

  • login - username or email
  • password - a secret word or phrase that must be used to gain admission to a system

Response parameters:

Status codes:

  • 200 – no error
  • 400 – incorrect json
  • 401 – access denied
  • 406 – bad parameter
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • INCORRECT_JSON
  • BAD_PARAMETER_LOGIN
  • BAD_PARAMETER_PASSWORD
  • INTERNAL_SERVER_ERROR

REQUEST

POST /session HTTP/1.1
Content-Type: application/json
{
  "login": "demo",
  "password": "Aup7TLTJmh"
}

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
{
  "token": "<token>"
}

Get

Response parameters:

Status codes:

  • 200 – no error
  • 401 – access denied
  • 404 – not found
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • USER_NOT_FOUND
  • INTERNAL_SERVER_ERROR

REQUEST

GET /user HTTP/1.1
Authorization: Bearer <token>

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
{
  "id": "7e8514c7-979a-4261-a0b8-9fbe0ea111f9",
  "username": "demo",
  "email": "demo@lastbackend.com",
  "gravatar": "e496e1534d71eabe640f6a0d0440c2c0",
  "balance": 10.0,
  "organization": false,
  "profile": {
    "first_name": "Jacob",
    "last_name": "Wilson",
    "company": "Last.Backend"
  },
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}


Project

Object structure

Paramrters:

Name Type Description
id string unique identificator
user string user unique identificator
name string project name
description string project description
created string information when about the project was created
updated string information when about the project was last updated
{
  "id": "ef3ad1ff-4b9a-4d1c-9bf7-6095e0cafd74",
  "user": "7e8514c7-979a-4261-a0b8-9fbe0ea111f9",
  "name": "test-project",
  "description": "test-project description",
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}

Create

Request parameters:

Body:

  • name - project unique name
  • description - project description info

Response parameters:

Status codes:

  • 200 – no error
  • 400 – incorrect json
  • 401 – access denied
  • 406 – bad parameter
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • INCORRECT_JSON
  • BAD_PARAMETER_NAME
  • NAME_NOT_UNIQUE

REQUEST

POST /project HTTP/1.1
Authorization: Bearer <token>
{
  "name": "test-project",
  "description": "this description info about this project"
}

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
{
  "id": "ef3ad1ff-4b9a-4d1c-9bf7-6095e0cafd74",
  "name": "test-project",
  "description": "this description info about this project",
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}

Get

Request parameters:

Query:

  • id - unique identificator or unique name

Response parameters:

Status codes:

  • 200 – no error
  • 401 – access denied
  • 404 – not found
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • PROJECT_NOT_FOUND
  • INTERNAL_SERVER_ERROR

REQUEST

GET /project/{id} HTTP/1.1
Authorization: Bearer <token>

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
{
  "id": "ef3ad1ff-4b9a-4d1c-9bf7-6095e0cafd74",
  "name": "test-project",
  "description": "this description info about this project",
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}

List

Response parameters:

Status codes:

  • 200 – no error
  • 401 – access denied
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • INTERNAL_SERVER_ERROR

REQUEST

GET /project HTTP/1.1
Authorization: Bearer <token>

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
[{
  "id": "ef3ad1ff-4b9a-4d1c-9bf7-6095e0cafd74",
  "name": "test-project",
  "description": "this description info about this project",
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}]

Update

Request parameters:

Query:

  • id - unique identificator or project name

Body:

  • name - project unique name
  • description - project description info

Response parameters:

Status codes:

  • 200 – no error
  • 400 – incorrect json
  • 401 – access denied
  • 406 – bad parameter
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • INCORRECT_JSON
  • BAD_PARAMETER_NAME
  • NAME_NOT_UNIQUE
  • INTERNAL_SERVER_ERROR

REQUEST

PUT /project/{id} HTTP/1.1
Authorization: Bearer <token>
{
  "name": "test-new-project",
  "description": "this new description info about this project"
}

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
{
  "id": "ef3ad1ff-4b9a-4d1c-9bf7-6095e0cafd74",
  "name": "test-new-project",
  "description": "this new description info about this project",
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}

Remove

Request parameters:

Query:

  • id - unique identificator or project name

Response parameters:

Status codes:

  • 200 – no error
  • 401 – access denied
  • 404 – not found
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • PROJECT_NOT_FOUND
  • INTERNAL_SERVER_ERROR

REQUEST

DELETE /project/{id} HTTP/1.1
Authorization: Bearer <token>

RESPONSE

HTTP/1.1 200 OK


Service

Object structure

Paramrters:

Name Type Description
id string unique identificator
project string project unique identificator
name string service name
{
  "id": "e92a93b5-374b-4d3c-a094-f510666a663d",
  "project": "ef3ad1ff-4b9a-4d1c-9bf7-6095e0cafd74",
  "name": "test-service",
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}

Create

Request parameters:

Query:

  • project - unique identificator or project name

Body:

  • name - unique name in project

Response parameters:

Status codes:

  • 200 – no error
  • 400 – incorrect json
  • 401 – access denied
  • 404 – not found
  • 406 – bad parameter
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • TEMPLATE_NOT_FOUND
  • INCORRECT_JSON
  • BAD_PARAMETER_NAME
  • BAD_PARAMETER_PROJECT
  • BAD_PARAMETER_TEMPLATE_NAME
  • NAME_NOT_UNIQUE
  • INTERNAL_SERVER_ERROR

REQUEST

POST /project/{project}/service HTTP/1.1
Authorization: Bearer <token>
{
  "name": "test-service"
}

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
{
  "id": "e92a93b5-374b-4d3c-a094-f510666a663d",
  "project": "ef3ad1ff-4b9a-4d1c-9bf7-6095e0cafd74",
  "name": "test-service",
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}

Get

Request parameters:

Query:

  • project - unique identificator or project name
  • service - unique identificator or service name

Response parameters:

Status codes:

  • 200 – no error
  • 401 – access denied
  • 404 – not found
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • SERVICE_NOT_FOUND
  • INTERNAL_SERVER_ERROR

REQUEST

GET /project/{project}/service/{service} HTTP/1.1
Authorization: Bearer <token>

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
{
  "id": "e92a93b5-374b-4d3c-a094-f510666a663d",
  "project": "ef3ad1ff-4b9a-4d1c-9bf7-6095e0cafd74",
  "name": "test-service",
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}

List

Response parameters:

Query:

  • project - unique identificator or project name

Status codes:

  • 200 – no error
  • 401 – access denied
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • INTERNAL_SERVER_ERROR

REQUEST

GET /project/{project}/service HTTP/1.1
Authorization: Bearer <token>

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
[{
  "id": "e92a93b5-374b-4d3c-a094-f510666a663d",
  "project": "ef3ad1ff-4b9a-4d1c-9bf7-6095e0cafd74",
  "name": "test-service",
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}]

Update

Request parameters:

Query:

  • project - unique identificator or project name
  • service - unique identificator or service name

Body:

  • name - unique name in project

Response parameters:

Status codes:

  • 200 – no error
  • 400 – incorrect json
  • 401 – access denied
  • 404 – not found
  • 406 – bad parameter
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • TEMPLATE_NOT_FOUND
  • INCORRECT_JSON
  • BAD_PARAMETER_NAME
  • NAME_NOT_UNIQUE
  • INTERNAL_SERVER_ERROR

REQUEST

PUT /project/{project}/service/{service} HTTP/1.1
Authorization: Bearer <token>
{
  "name": "test-new-service"
}

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
{
  "id": "e92a93b5-374b-4d3c-a094-f510666a663d",
  "project": "ef3ad1ff-4b9a-4d1c-9bf7-6095e0cafd74",
  "name": "test-new-service",
  "created": "2014-01-16T07:38:28.45Z",
  "updated": "2014-01-16T07:38:28.45Z"
}

Remove

Request parameters:

Query:

  • project - unique identificator or project name
  • id - unique identificator or service name

Response parameters:

Status codes:

  • 200 – no error
  • 401 – access denied
  • 404 – not found
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • SERVICE_NOT_FOUND
  • INTERNAL_SERVER_ERROR

REQUEST

DELETE /project/{project}/service/{service} HTTP/1.1
Authorization: Bearer <token>

RESPONSE

HTTP/1.1 200 OK

Deploy

Request parameters

Body:

  • project - unique project id
  • target - template:version or url for git repo

Response parameters:

Status codes:

  • 200 – no error
  • 400 - incorrect json
  • 401 - access denied
  • 404 - not found
  • 406 - bad parameter
  • 500 – server error

Errors:

  • ACCESS_DENIED
  • INCORRECT_JSON
  • BAD_PARAMETER_PROJECT
  • BAD_PARAMETER_TARGET
  • PROJECT_NOT_FOUND
  • INTERNAL_SERVER_ERROR

REQUEST

POST /deploy HTTP/1.1

RESPONSE

HTTP/1.1 200 OK


Template

Object structure

Paramrters:

Name Type Description
template-name array list versions by template
{
  "mysql-wordpress": [
    "latest"
  ],
  "nodesjs-mongodb": [
    "latest"
  ]
}

List

Response parameters:

Status codes:

  • 200 – no error
  • 500 – server error

Errors:

  • INTERNAL_SERVER_ERROR

REQUEST

GET /template HTTP/1.1

RESPONSE

HTTP/1.1 200 OK
Content-Type: application/json
{
  "mysql-wordpress": [
    "latest"
  ],
  "nodesjs-mongodb": [
    "latest"
  ]
}