mirror of
https://github.com/grafana/grafana.git
synced 2026-08-11 05:34:53 -05:00
Query history: Add swagger definitions (#50498)
* Query history: Add swagger definitions
* Update
* Remove changes in generated files
* Generate api files
* Add query history into api docs
* Add examples for commands
* Add missing parameters
* Generate api-spec and api-merged
* Fix linting
* Fix showing of example of queries
* Revert "Fix showing of example of queries"
This reverts commit b1eb073fbe.
* Update
* Update
This commit is contained in:
@@ -38,6 +38,7 @@ dashboards, creating users, and updating data sources.
|
||||
- [Playlists API]({{< relref "playlist/" >}})
|
||||
- [Preferences API]({{< relref "preferences/" >}})
|
||||
- [Short URL API]({{< relref "short_url/" >}})
|
||||
- [Query history API]({{< relref "query_history/" >}})
|
||||
- [Snapshot API]({{< relref "snapshot/" >}})
|
||||
- [Team API]({{< relref "team/" >}})
|
||||
- [User API]({{< relref "user/" >}})
|
||||
|
||||
@@ -82,7 +82,8 @@ Status codes:
|
||||
|
||||
- **200** – OK
|
||||
- **400** - Errors (invalid JSON, missing or invalid fields)
|
||||
- **500** – Unable to add query to the database
|
||||
- **401** – Unauthorized
|
||||
- **500** – Internal error
|
||||
|
||||
## Query history search
|
||||
|
||||
@@ -144,7 +145,8 @@ Content-Type: application/json
|
||||
Status codes:
|
||||
|
||||
- **200** – OK
|
||||
- **500** – Unable to add query to the database
|
||||
- **401** – Unauthorized
|
||||
- **500** – Internal error
|
||||
|
||||
## Delete query from Query history by UID
|
||||
|
||||
@@ -176,7 +178,8 @@ Content-Type: application/json
|
||||
Status codes:
|
||||
|
||||
- **200** – OK
|
||||
- **500** – Unable to delete query from the database
|
||||
- **401** – Unauthorized
|
||||
- **500** – Internal error
|
||||
|
||||
## Update comment of query in Query history by UID
|
||||
|
||||
@@ -232,7 +235,8 @@ Status codes:
|
||||
|
||||
- **200** – OK
|
||||
- **400** - Errors (invalid JSON, missing or invalid fields)
|
||||
- **500** – Unable to update comment of query in the database
|
||||
- **401** – Unauthorized
|
||||
- **500** – Internal error
|
||||
|
||||
## Star query in Query history
|
||||
|
||||
@@ -280,7 +284,8 @@ Content-Type: application/json
|
||||
Status codes:
|
||||
|
||||
- **200** – OK
|
||||
- **500** – Unable to star query in the database
|
||||
- **401** – Unauthorized
|
||||
- **500** – Internal error
|
||||
|
||||
## Unstar query in Query history
|
||||
|
||||
@@ -328,4 +333,64 @@ Content-Type: application/json
|
||||
Status codes:
|
||||
|
||||
- **200** – OK
|
||||
- **500** – Unable to unstar query in the database
|
||||
- **401** – Unauthorized
|
||||
- **500** – Internal error
|
||||
|
||||
## Migrate queries to Query history
|
||||
|
||||
`POST /api/query-history/migrate`
|
||||
|
||||
Migrates multiple queries in to query history.
|
||||
|
||||
**Example request:**
|
||||
|
||||
```http
|
||||
POST /api/query-history HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
{
|
||||
"queries": [
|
||||
{
|
||||
"datasourceUid": "PE1C5CBDA0504A6A3",
|
||||
"queries": [
|
||||
{
|
||||
"refId": "A",
|
||||
"key": "Q-87fed8e3-62ba-4eb2-8d2a-4129979bb4de-0",
|
||||
"scenarioId": "csv_content",
|
||||
"datasource": {
|
||||
"type": "testdata",
|
||||
"uid": "PD8C576611E62080A"
|
||||
}
|
||||
}
|
||||
],
|
||||
"starred": false,
|
||||
"createdAt": 1643630762,
|
||||
"comment": "debugging"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
JSON body schema:
|
||||
|
||||
- **queries** – JSON of query history items.
|
||||
|
||||
**Example response:**
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
{
|
||||
"message": "Query history successfully migrated",
|
||||
"totalCount": 105,
|
||||
"starredCount": 10
|
||||
}
|
||||
```
|
||||
|
||||
Status codes:
|
||||
|
||||
- **200** – OK
|
||||
- **400** - Errors (invalid JSON, missing or invalid fields)
|
||||
- **401** – Unauthorized
|
||||
- **500** – Internal error
|
||||
|
||||
Reference in New Issue
Block a user