Skip to content

API v0.2

cmbrose edited this page Feb 23, 2015 · 20 revisions

#Lighthouse Remote API v0.2

Note: Prepend all endpoints with /api/v0.2

All endpoints listed in v0.1 are supported in addition to the following:

Contents:

  1. Beacons
    1. Exposed endpoints
    2. Examples
  2. Aliases
    1. Exposed endpoints
    2. Examples

##Beacons API ###Exposed endpoints

These endpoints offer support for connecting to and updating running beacon instances

POST /beacons/create HTTP/1.1
Content-Type: application/json

{
    "Address": "<Beacon address>",
    "Token": "<Beacon token>",
    "Users": ["[email protected]", "..."]
}
PUT /beacons/token/{Instance} HTTP/1.1
Content-Type: application/json

"<Beacon Token>"
PUT /beacons/address/{Instance}/{Address} HTTP/1.1
GET /beacons/list HTTP/1.1
GET /beacons/list/{Address} HTTP/1.1

###Examples:

Connect to a new beacon:

  • The beacon is located at example.com/mybeacon
  • Only the [email protected] can access the beacon's token

Request:

POST /beacons/create HTTP/1.1
Content-Type: application/json

{
    "Address": "example.com/mybeacon",
    "Token": "MY_TOKEN",
    "Users": ["[email protected]"]
}

Response:

HTTP/1.1 200 OK

Attempting to authorize a user to access an unknown beacon:

Request:

PUT /beacons/user/bad_docker_address/[email protected] HTTP/1.1

Response:

HTTP/1.1 400 BadRequest
databases: given key not found

Requesting a list of known beacons:

Request:

GET /beacons/list HTTP/1.1

Response:

HTTP/1.1 200 OK
[ "127.0.0.1:5002" ]

Requesting a list of instances connected to the beacon at 127.0.0.1:5001:

Request:

GET /beacons/list/127.0.0.1:5002 HTTP/1.1

Response:

HTTP/1.1 200 OK
[ "127.0.0.1:5001/v1.12" ]

[TOP]

##Beacons API ###Exposed endpoints

PUT /aliases/{Alias} HTTP/1.1

"Address"

###Examples:

Updating/creating a valid alias:

Request:

PUT /aliases/boot2docker HTTP/1.1

"127.0.0.1:5001/v1.12"

Response:

HTTP/1.1 200 OK

Updating/creating an invalid alias:

Request:

PUT /aliases/boot2docker HTTP/1.1

""

Response:

HTTP/1.1 400 BadRequest

[TOP]

Clone this wiki locally