How to use the REST API Endpoints

Overview

ClusterCockpit offers several REST API Endpoints. While some are integral part of the ClusterCockpit-Stack Workflow (such asstart_job), others are optional. These optional endpoints supplement the functionality of the webinterface with information reachable from scripts or the command line.

Admin Accessible REST API

These endpoints are secured by JWT authentication. As such, all prerequisites applicable to Json Web Tokens apply in this case as well, e.g. private and public key setup.

Admin API Prerequisites

  1. JWT has to be generated by either a dedicated API user (Has only api role) or an Administrator with both admin and api roles.
  2. JWTs have a limited lifetime, i.e. will become invalid after a configurable amount of time (see jwt.max-age config option).
  3. These endpoints are additionally subjected to a configurable IP whitelist (see apiAllowedIPs config option). The config option has to be present with at least the wildcard * as only entry.

Admin API Endpoints and Functions

EndpointMethodRequestDescription
/api/users/GET-Lists all Users
/api/clusters/GET-Lists all Clusters
/api/jobs/start_job/POST, PUTJSON PayloadStarts Job
/api/jobs/stop_job/POST, PUTJSON PayloadStops Jobs
/api/jobs/GETURL-Query ParamsLists Jobs
/api/jobs/{id}POST$id, JSON PayloadLoads specified job metadata
/api/jobs/{id}GET$idLoads specified job with metrics
/api/jobs/tag_job/{id}POST, PATCH$id, JSON PayloadTags specified job with tag ids in payload
/api/jobs/edit_meta/{id}POST, PATCH$id, JSON PayloadEdits meta_data db colums info
/api/jobs/metrics/{id}GET$id, URL-Query ParamsLoads specified jobmetrics for metric and scope params
/api/jobs/delete_job/DELETEJSON PayloadDeletes job specified in payload
/api/jobs/delete_job/{id}DELETE$id, JSON PayloadDeletes job specified by db id
/api/jobs/delete_job_before/{ts}DELETE$tsDeletes all jobs before specified unix timestamp

User Accessible REST API

These endpoints are secured by JWT authentication. As such, all prerequisites applicable to Json Web Tokens apply in this case as well, e.g. private and public key setup.

User API Prerequisites

  1. JWT has to be generated by either a dedicated API user (Has only api role) or an User with additional api role.
  2. JWTs have a limited lifetime, i.e. will become invalid after a configurable amount of time (see jwt.max-age config option).

User API Endpoints and Functions

EndpointMethodRequestDescription
/userapi/jobs/GETURL-Query ParamsLists Jobs
/userapi/jobs/{id}POST$id, JSON PayloadLoads specified job metadata
/userapi/jobs/{id}GET$idLoads specified job with metrics
/userapi/jobs/metrics/{id}GET$id, URL-Query ParamsLoads specified jobmetrics for metric and scope params