{
  "info": {
    "name": "Grafinya Plugin API",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [
    {
      "name": "WellKnown",
      "item": [
        {
          "name": "Get Plugin Metadata",
          "description": "В ответе поле queryHelp — подсказка для поля ввода запроса (если выбран режим запроса JSON).",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/api/v1/well-known",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "well-known"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Datasource",
      "item": [
        {
          "name": "Health Check",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"fields\": [\n    {\n      \"code\": \"url\",\n      \"name\": \"URL\",\n      \"description\": \"Datasource URL\",\n      \"placeholder\": \"https://example.com\",\n      \"validationRule\": \"^https?:\\\\/\\\\/\",\n      \"validationMessage\": \"Must be a valid URL\",\n      \"required\": true,\n      \"value\": \"http://example.com\"\n    },\n    {\n      \"code\": \"port\",\n      \"name\": \"Port\",\n      \"description\": \"Datasource port\",\n      \"placeholder\": \"9090\",\n      \"validationRule\": \"^[0-9]*$\",\n      \"min\": 80,\n      \"max\": 49151,\n      \"value\": \"9090\"\n    },\n    {\n      \"code\": \"login\",\n      \"name\": \"Login\",\n      \"placeholder\": \"Enter login\",\n      \"validationRule\": \"^[a-zA-Z0-9_.-]*$\",\n      \"required\": true,\n      \"value\": \"admin\"\n    },\n    {\n      \"code\": \"pass\",\n      \"name\": \"Password\",\n      \"placeholder\": \"Enter password\",\n      \"type\": \"password\",\n      \"validationRule\": \"^[a-zA-Z0-9_.-]*$\",\n      \"required\": true,\n      \"value\": \"admin\"\n    }\n  ]\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/datasource/health-check",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "datasource",
                "health-check"
              ]
            }
          }
        },
        {
          "name": "Get Datasource Constructor Fields",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept-Language",
                "value": "{{acceptLanguage}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"pluginContext\": {\n    \"orgID\": 0,\n    \"pluginID\": \"pult1\",\n    \"dataSourceInstanceSettings\": {\n      \"fields\": []\n    }\n  },\n  \"filter\": {\n    \"from\": 1729848300,\n    \"to\": 1729870200,\n    \"fields\": []\n  },\n  \"variables\": {}\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/datasource/constructor-fields",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "datasource",
                "constructor-fields"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Query",
      "item": [
        {
          "name": "Get Query Constructor Fields",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept-Language",
                "value": "{{acceptLanguage}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"pluginContext\": {\n    \"orgID\": 0,\n    \"pluginID\": \"pult1\",\n    \"dataSourceInstanceSettings\": {\n      \"fields\": []\n    }\n  },\n  \"filter\": {\n    \"from\": 1729848300,\n    \"to\": 1729870200,\n    \"fields\": []\n  },\n  \"variables\": {}\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/query/constructor-fields",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "query",
                "constructor-fields"
              ]
            }
          }
        },
        {
          "name": "Get Query Result",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"pluginContext\": {\n    \"orgID\": 0,\n    \"pluginID\": \"pult1\",\n    \"dataSourceInstanceSettings\": {\n      \"fields\": [\n        {\n          \"code\": \"url\",\n          \"name\": \"URL\",\n          \"description\": \"Datasource URL\",\n          \"placeholder\": \"https://example.com\",\n          \"validationRule\": \"^https?:\\\\/\\\\/\",\n          \"validationMessage\": \"Must be a valid URL\",\n          \"required\": true,\n          \"value\": \"http://example.com\"\n        }\n      ]\n    }\n  },\n  \"dataQuery\": [\n    {\n      \"refID\": \"id1\",\n      \"maxDataPoints\": 1000,\n      \"timeRange\": {\n        \"from\": 1729848300,\n        \"to\": 1729870200\n      },\n      \"json\": \"{\\\"metricName\\\":\\\"jvm_threads_daemon_threads\\\",\\\"seriesName\\\":\\\"Threads\\\",\\\"selectors\\\":{\\\"application\\\":\\\"example\\\"}}\"\n    }\n  ],\n  \"variables\": {}\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/query/get-result",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "query",
                "get-result"
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Variable",
      "item": [
        {
          "name": "Get Variable Constructor Fields",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Accept-Language",
                "value": "{{acceptLanguage}}"
              },
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"pluginContext\": {\n    \"orgID\": 0,\n    \"pluginID\": \"pult1\",\n    \"dataSourceInstanceSettings\": {\n      \"fields\": []\n    }\n  },\n  \"filter\": {\n    \"from\": 1729848300,\n    \"to\": 1729870200,\n    \"fields\": []\n  },\n  \"variables\": {}\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/variable/constructor-fields",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "variable",
                "constructor-fields"
              ]
            }
          }
        },
        {
          "name": "Get Variable Values",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"pluginContext\": {\n    \"orgID\": 0,\n    \"pluginID\": \"pult1\",\n    \"dataSourceInstanceSettings\": {\n      \"fields\": []\n    }\n  },\n  \"json\": \"{}\",\n  \"variables\": {}\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/api/v1/variable/values",
              "host": [
                "{{baseUrl}}"
              ],
              "path": [
                "api",
                "v1",
                "variable",
                "values"
              ]
            }
          }
        }
      ]
    }
  ],
  "variable": [
    {
      "key": "baseUrl",
      "value": "http://plugin-domain"
    },
    {
      "key": "acceptLanguage",
      "value": "ru-RU"
    }
  ]
}
