Skip to content

API Routes

Chris edited this page Jun 24, 2021 · 5 revisions

API

Manticore has a small API for how much it does in the background. These are the available routes.

GET /health

Returns a status code of 200, or if advanced health checking is enabled, returns an object describing the healthiness of the server:

{
    "isHealthy": true,
    "stuckWaiting": false
}

All routes below are prefixed with /api/v2/

GET /job

Returns all available job types. Job types are dependent on what the job interface module returns.

{
    "core": {
        "versions": [
            "7.1.1"
        ],
        "builds": [
            "default"
        ]
    },
    "hmis": [
        {
            "type": "generic",
            "versions": [
                "minimal-0.10.0"
            ]
        }
    ]
}

POST /job

Submits a job to be run on Manticore. Since it is expected that jobs may take a long time to be ready for a user, the request does not hang and instead the server responds with a generated passcode. This passcode can be used to make a WebSocket connection to the server and it can then provide updates such as their instance address information and their position in the waiting list. Invalid passcodes will not permit a WebSocket connection from happening.

{
    "id": 3, //if JWT_SECRET is disabled, this is required. This uniquely identifies a client's request
    "core": { //example sdl_core settings
        "version": "7.1.1",
        "build": "default"
    },
    "hmi": { //example generic_hmi settings
        "type": "generic",
        "version": "minimal-0.10.0"
    }
}

DELETE /job

Stops the job and kicks the user out of Manticore’s system. This should be run to help free resources for other users.

{
    "id": 3, //if JWT_SECRET is disabled, this is required
}

WEBSOCKET /job/:passcode

A client can connect to this route over WebSockets. POST /job returns a unique passcode that is used as part of this route. Manticore remembers that passcode associated with the id of the request, so that when the user connects to this route with that same passcode then Manticore knows who that user is. Different types of stringified objects are sent to the client over time to inform the client of events such as their job’s address information.