Get structured DQL suggestions in Dynatrace Query API for the current cursor position, helping you complete a query with valid next tokens.
| POST | SaaS | https://{your-environment-id}.apps.dynatrace.com/platform/storage/query/v1/query:autocomplete |
For information about the required permissions see the Bucket and table permissions in Grail documentation.
We provide a list of suggestions that may be used after the cursor position. The following queries will all provide the same results:
query: "f"query: "f", cursorPosition:1query: "fetch ", cursorPosition:1Available fields:
| Field | Description |
|---|---|
suggestions | a list of suggestions. Each item is a separate possible suggestion, despite they might have the same outputs. |
optional | whether the suggestion is optional. If |
Fields in the suggestions
| Field | Description |
|---|---|
suggestion | a string representing the whole suggestion. This information could also be derived from the parts. |
alreadyTypedCharacters | how many characters of this suggestion have already been typed (and will be overridden by the suggestion). |
parts | a list of semantically enriched information on what are the parts of a suggestion. |
Fields in parts
| Field | Description |
|---|---|
suggestion | a string representing the current part of the suggestion. |
type | current types: SPACE, PIPE, COMMAND (may be extended) |
The type helps to treat specific parts of the suggestion different to others; either by a different visualization,
a link to docs, etc.
To execute this request, you need a platform token or OAuth access token with one of the following scopes:
storage:bizevents:readstorage:buckets:readstorage:entities:readstorage:events:readstorage:fieldsets:readstorage:logs:readstorage:metrics:readstorage:spans:readstorage:system:readTo learn how to obtain and use it, see Tokens and authentication.
| Parameter | Type | Description | In | Required |
|---|---|---|---|---|
| dt-client-context | string | The dt-client-context header is an optional string parameter used for monitoring purposes. When included in a request, it helps retrieve information about the execution of the query. It shouldn't hold sensitive information. | header | Optional |
| body | Autocomplete | All query parameters can also be passed via JSON in the POST body. It's not allowed to specify a parameter twice. 'query' has to be present either as a query parameter or in the request body. | body | Required |
AutocompleteRequest object| Element | Type | Description | Required |
|---|---|---|---|
| cursorPosition | integer | No upper limit but must be lower than length of query. No default value. | Optional |
| enforceQueryConsumptionLimit | boolean | Boolean to indicate if the query consumption limit should be enforced | Optional |
| locale | string | The query locale. If none specified, then a language/country neutral locale is chosen. The input values take the ISO-639 Language code with an optional ISO-3166 country code appended to it with an underscore. For instance, both values are valid 'en' or 'en_US'. | Optional |
| maxDataSuggestions | integer | Limit the number of data suggestions, such as field names. No upper limit. No default value. | Optional |
| query | string | The full query string. | Required |
| queryOptions | Query | Query options enhance query functionality for Dynatrace internal services. | Optional |
| timezone | string | The query timezone. If none is specified, UTC is used as fallback. The list of valid input values matches that of the IANA Time Zone Database (TZDB). It accepts values in their canonical names like 'Europe/Paris', the abbreviated version like CET or the UTC offset format like '+01:00' | Optional |
QueryOptions objectQuery options enhance query functionality for Dynatrace internal services.
This is a model of the request body, showing the possible elements. It has to be adjusted for usage in an actual request.
{"cursorPosition": 1,"enforceQueryConsumptionLimit": true,"locale": "en_US","maxDataSuggestions": 1,"query": "fetch events \n| filter event.type == \"davis\" AND davis.status != \"CLOSED\" \n| fields timestamp, davis.title, davis.underMaintenance, davis.status \n| sort timestamp \n| limit 10","queryOptions": null,"timezone": "UTC"}
| Code | Type | Description |
|---|---|---|
| 200 | Autocomplete | A list of structured autocomplete suggestions. |
| 400 | Error | Bad Request - The caller submitted an invalid request (e.g., mandatory parameters missing). |
| 401 | - | - |
| 403 | - | - |
| 404 | - | - |
| 405 | - | - |
| 415 | - | - |
| 500 | - | - |
| 503 | - | - |
| 504 | - | - |
AutocompleteResponse objectThe response of the autocomplete call.
| Element | Type | Description |
|---|---|---|
| optional | boolean | True if the suggestions are optional. |
| suggestedTtlSeconds | integer | Suggested duration in seconds, for how long the response may be cached and reused by the client. It is derived from the volatility of the suggestions on the server (if the suggestions are static, how long the server will cache the volatile suggestions, ...). If not provided, then the result may be cached for long time. Value below 1 means that the result should not be cached. |
| suggestions | Autocomplete | The list of suggestions. |
AutocompleteSuggestion objectSingle suggestion for completion of the query.
| Element | Type | Description |
|---|---|---|
| alreadyTypedCharacters | integer | Number of characters that the user already typed for this suggestion. |
| parts | Autocomplete | List of suggestion parts. |
| suggestion | string | The suggested continuation of the query. |
AutocompleteSuggestionPart objectPart of the suggestion.
| Element | Type | Description |
|---|---|---|
| info | string | The type of the suggestion. |
| suggestion | string | The suggested continuation of the query. |
| synopsis | string | The synopsis of the suggestion. |
| type | Token | The type of the autocomplete token. The element can hold these values
|
TokenType objectThe type of the autocomplete token.
ErrorEnvelope objectAn 'envelope' error object that has the mandatory error object.
| Element | Type | Description |
|---|---|---|
| error | Error | The response for error state |
ErrorResponse objectThe response for error state
| Element | Type | Description |
|---|---|---|
| code | integer | Error code, which normally matches the HTTP error code. |
| details | Error | Detailed information about the error. |
| message | string | A short, clear error message without details |
| retryAfterSeconds | integer | The number of seconds to wait until the next retry. |
ErrorResponseDetails objectDetailed information about the error.
| Element | Type | Description |
|---|---|---|
| arguments | string[] | The arguments for the message format. |
| constraintViolations | object[] | Information about an input parameter that violated some validation rule of the service API. |
| errorMessage | string | Complete error message. |
| errorMessageFormat | string | The message format of the error message, string.format based. |
| errorMessageFormatSpecifierTypes | string[] | The corresponding DQL format specifier types for each format specifier used in the error message format. |
| errorType | string | The error type, e.g. COMMAND_NAME_MISSING |
| exceptionType | string | The exception type. |
| missingPermissions | string[] | List of missing IAM permissions necessary to successfully execute the request. |
| missingScopes | string[] | List of missing IAM scopes necessary to successfully execute the request. |
| queryId | string | - |
| queryString | string | Submitted query string. |
| syntaxErrorPosition | Token | The position of a token in a query string used for errors and notification to map the message to a specific part of the query. |
TokenPosition objectThe position of a token in a query string used for errors and notification to map the message to a specific part of the query.
| Element | Type | Description |
|---|---|---|
| end | Position | The exact position in the query string. |
| start | Position | The exact position in the query string. |
PositionInfo objectThe exact position in the query string.
| Element | Type | Description |
|---|---|---|
| column | integer | Query position column zero based index. |
| index | integer | Query position index. |
| line | integer | Query position line zero based index. |
{"optional": true,"suggestions": [{"alreadyTypedCharacters": 4,"parts": [{"info": "the name of the new field","suggestion": "alias","type": "PARAMETER_KEY"},{"suggestion": ":","type": "COLON"}],"suggestion": "alias:"},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "*","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " * "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "/","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " / "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "%","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " % "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "+","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " + "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "-","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " - "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "==","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " == "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "!=","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " != "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "<","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " < "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": ">","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " > "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "<=","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " <= "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": ">=","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " >= "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "AND","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " AND "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "XOR","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " XOR "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": " ","type": "SPACE"},{"suggestion": "OR","type": "OPERATOR"},{"suggestion": " ","type": "SPACE"}],"suggestion": " OR "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": ",","type": "COMMA"},{"suggestion": " ","type": "SPACE"}],"suggestion": ", "},{"alreadyTypedCharacters": 0,"parts": [{"suggestion": "|","type": "PIPE"}],"suggestion": "|"}]}
{"error": {"code": 400,"details": {"constraintViolations": [{"message": "must not be null","parameterDescriptor": "query"}]},"message": "Constraint Violations"}}