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 b1eb073fbe26fd41351226dde7bdca33838c78f7.

* Update

* Update
This commit is contained in:
Ivana Huckova
2022-06-13 09:47:40 +02:00
committed by GitHub
parent 088a1880d8
commit 0ddb3b7521
9 changed files with 1211 additions and 56 deletions

View File

@ -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/" >}})

View File

@ -82,7 +82,8 @@ Status codes:
```http
HTTP/1.1 200
Content-Type: application/json
```
{
```
Status codes:
@ -144,7 +145,8 @@ Content-Type: application/json
```http
HTTP/1.1 200
Content-Type: application/json
{
```
Status codes:
@ -176,7 +178,8 @@ Content-Type: application/json
{
```
- **200** OK
Status codes:
- **200** OK
- **401** Unauthorized
- **500** Internal error
@ -232,7 +235,8 @@ Status codes:
**Example response:**
- **500** Unable to update comment of query in the database
```http
HTTP/1.1 200
Content-Type: application/json
{
```
@ -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