mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 10:13:01 +08:00
Correlations: Add CreateCorrelation HTTP API (#51630)
* Correlations: add migration * Correlations: Add CreateCorrelation API * Correlations: Make correlations work with provisioning * Handle version changes * Fix lining error * lint fixes * rebuild betterer results * add a UID to each correlation * Fix lint errors * add docs * better wording in API docs * remove leftover comment * handle ds updates * Fix error message typo * add bad data test * make correlations a separate table * skip readonly check when provisioning correlations * delete stale correlations when datasources are deleted * restore provisioned readonly ds * publish deletion event with full data * generate swagger and HTTP API docs * apply source datasource permission to create correlation API * Fix tests & lint errors * ignore empty deletion events * fix last lint errors * fix more lint error * Only publish deletion event if datasource was actually deleted * delete DS provisioning deletes correlations, added & fixed tests * Fix unmarshalling tests * Fix linting errors * Fix deltion event tests * fix small linting error * fix lint errors * update betterer * fix test * make path singular * Revert "make path singular" This reverts commit 420c3d315e83ef9a7154766c812a24c7b02fc104. * add integration tests * remove unneeded id from correlations table * update spec * update leftover references to CorrelationDTO * fix tests * cleanup tests * fix lint error
This commit is contained in:
70
docs/sources/developers/http_api/correlations.md
Normal file
70
docs/sources/developers/http_api/correlations.md
Normal file
@ -0,0 +1,70 @@
|
||||
---
|
||||
aliases:
|
||||
- /docs/grafana/latest/developers/http_api/correlations/
|
||||
- /docs/grafana/latest/http_api/correlations/
|
||||
description: Grafana Correlations HTTP API
|
||||
keywords:
|
||||
- grafana
|
||||
- http
|
||||
- documentation
|
||||
- api
|
||||
- correlations
|
||||
- Glue
|
||||
title: 'Correlations HTTP API '
|
||||
---
|
||||
|
||||
# Correlations API
|
||||
|
||||
This API can be used to define correlations between data sources.
|
||||
|
||||
## Create correlations
|
||||
|
||||
`POST /api/datasources/uid/:sourceUid/correlations`
|
||||
|
||||
Creates a correlation between two data sources - the source data source indicated by the path UID, and the target data source which is specified in the body.
|
||||
|
||||
**Example request:**
|
||||
|
||||
```http
|
||||
POST /api/datasources/uid/uyBf2637k/correlations HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
{
|
||||
```
|
||||
|
||||
JSON body schema:
|
||||
|
||||
- **targetUid** – Target data source uid.
|
||||
- **label** – A label for the correlation.
|
||||
- **description** – A description for the correlation.
|
||||
|
||||
**Example response:**
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
{
|
||||
```
|
||||
|
||||
Status codes:
|
||||
|
||||
- **200** – OK
|
||||
- **400** - Errors (invalid JSON, missing or invalid fields)
|
||||
- **401** – Unauthorized
|
||||
- **403** – Forbidden, source data source is read-only
|
||||
- **404** – Not found, either source or target data source could not be found
|
||||
- **500** – Internal error
|
||||
"uid": "50xhMlg9k"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Status codes:
|
||||
|
||||
- **200** – OK
|
||||
- **400** - Errors (invalid JSON, missing or invalid fields)
|
||||
- **401** – Unauthorized
|
||||
- **403** – Forbidden, source data source is read-only
|
||||
- **404** – Not found, either source or target data source could not be found
|
||||
- **500** – Internal error
|
Reference in New Issue
Block a user