🚧 [Experimental] Get SQL query
Returns the specified saved SQL query.
Request
POST
https://api.datalens.tech/rpc/getSqlQuery
Headers
|
Name |
Description |
|
x-dl-api-version |
Type: string API version header. Const: Example: |
Body
application/json
{
"sqlQueryId": "example",
"revId": "example",
"includePermissions": true,
"includeFavorite": true
}
|
Name |
Description |
|
sqlQueryId |
Type: string ID of the SQL query to retrieve. Example: |
|
includeFavorite |
Type: boolean Whether to include the favorite status. Deprecated: the parameter will be removed in a future API version. |
|
includePermissions |
Type: boolean Whether to include SQL query permissions. |
|
revId |
Type: string ID of the SQL query revision to retrieve. Example: |
Responses
200 OK
Response
Body
application/json
{
"entry": {
"entryId": "example",
"scope": "sql_query",
"type": "example",
"key": "example",
"workbookId": "example",
"collectionId": "example",
"revId": "example",
"savedId": "example",
"publishedId": "example",
"data": {
"connectionId": "example",
"query": "example",
"statementPositions": [
[
null
]
],
"params": [
{}
]
},
"annotation": {
"description": "example"
},
"createdBy": "example",
"createdAt": "example",
"updatedBy": "example",
"updatedAt": "example",
"revUpdatedBy": "example",
"revUpdatedAt": "example",
"tenantId": "example",
"hidden": true,
"version": 0.5,
"links": {}
},
"isFavorite": true,
"permissions": {
"execute": true,
"read": true,
"edit": true,
"admin": true
}
}
|
Name |
Description |
||||||||
|
entry |
Type: SqlQuery Example
|
||||||||
|
isFavorite |
Type: boolean Whether the SQL query is a favorite. Deprecated: the field will be removed in a future API version. |
||||||||
|
permissions |
Type: object
Permissions for the SQL query. Example
|
SqlQuery
|
Name |
Description |
||||||||||||||||||||||||||
|
annotation |
Type: object | null Annotation of the SQL query. Example
|
||||||||||||||||||||||||||
|
collectionId |
Type: string | null ID of the collection containing the SQL query. Example: |
||||||||||||||||||||||||||
|
createdAt |
Type: string Date and time when the SQL query was created. Example: |
||||||||||||||||||||||||||
|
createdBy |
Type: string ID of the user who created the SQL query. Example: |
||||||||||||||||||||||||||
|
data |
Type: object
Data of the SQL query entry. Example
|
||||||||||||||||||||||||||
|
entryId |
Type: string Unique identifier of the SQL query. Example: |
||||||||||||||||||||||||||
|
hidden |
Type: boolean Whether the SQL query is hidden. |
||||||||||||||||||||||||||
|
key |
Type: string Key of the SQL query entry. Example: |
||||||||||||||||||||||||||
|
publishedId |
Type: string | null ID of the published SQL query revision. Example: |
||||||||||||||||||||||||||
|
revId |
Type: string ID of the current SQL query revision. Example: |
||||||||||||||||||||||||||
|
savedId |
Type: string ID of the saved SQL query revision. Example: |
||||||||||||||||||||||||||
|
scope |
Type: string Scope of the SQL query entry. Const: Example: |
||||||||||||||||||||||||||
|
tenantId |
Type: string ID of the tenant that owns the SQL query. Example: |
||||||||||||||||||||||||||
|
type |
Type: string Type of the SQL query entry. Example: |
||||||||||||||||||||||||||
|
updatedAt |
Type: string Date and time when the SQL query was last updated. Example: |
||||||||||||||||||||||||||
|
updatedBy |
Type: string ID of the user who last updated the SQL query. Example: |
||||||||||||||||||||||||||
|
version |
Type: number | null Schema version of the SQL query. |
||||||||||||||||||||||||||
|
workbookId |
Type: string ID of the workbook containing the SQL query. Example: |
||||||||||||||||||||||||||
|
links |
Type: object | null Links to the entries the SQL query depends on. Example
|
||||||||||||||||||||||||||
|
revUpdatedAt |
Type: string Date and time when the current revision was last updated. Example: |
||||||||||||||||||||||||||
|
revUpdatedBy |
Type: string ID of the user who last updated the current revision. Example: |
Example
{
"entryId": "example",
"scope": "sql_query",
"type": "example",
"key": "example",
"workbookId": "example",
"collectionId": "example",
"revId": "example",
"savedId": "example",
"publishedId": "example",
"data": {
"connectionId": "example",
"query": "example",
"statementPositions": [
[
null
]
],
"params": [
{
"name": "example"
}
]
},
"annotation": {
"description": "example"
},
"createdBy": "example",
"createdAt": "example",
"updatedBy": "example",
"updatedAt": "example",
"revUpdatedBy": "example",
"revUpdatedAt": "example",
"tenantId": "example",
"hidden": true,
"version": 0.5,
"links": {}
}
No longer supported, please use an alternative and newer version.