API7 Docs
API7 GatewayAPI7 Enterprise Admin APIsGet data from Prometheus

Get data from Prometheus

POST /api/control_plane/prometheus/{prometheus_path}

POST /api/control_plane/prometheus/{prometheus_path}

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Path Parameters

prometheus_path*|

Prometheus HTTP API endpoint. See the Prometheus docs for the available body parameters for each endpoint.

Request Body

application/x-www-form-urlencoded

Response Body

application/json

curl -X POST "$API_BASE_URL/api/control_plane/prometheus/api/v1/query" \  -H "Content-Type: application/x-www-form-urlencoded" \  -d ''

The Prometheus proxy response.

{
  "value": {
    "status": "success",
    "data": {
      "resultType": "matrix",
      "result": [
        {
          "metric": {
            "label": "xxx"
          },
          "values": [
            [
              1684740675,
              1
            ],
            [
              1684740690,
              2
            ]
          ]
        }
      ]
    }
  }
}
Complete operation details and schema variants

POST /api/control_plane/prometheus/{prometheus_path}

Get data from Prometheus

Parameters

  • prometheus_path (path, string, required): Prometheus HTTP API endpoint. See the Prometheus docs for the available body parameters for each endpoint.

Request body

Content type: application/x-www-form-urlencoded

Responses

  • 200: The Prometheus proxy response.
  • allOf variant 1
  • value (object, optional): The specific resource.
  • allOf variant 2
  • value (object, optional): The Prometheus raw data.
  • 400: Invalid arguments. Error details will be provided in the response.

cURL

curl -X POST '$API_BASE_URL/api/control_plane/prometheus/{prometheus_path}'