get-query-results
The method returns query execution results. If the query contains multiple SELECT
statements, multiple query execution results are generated. In this case, get the results by their index.
When using the HTTP API, authenticate and specify the required headers. You can also specify optional headers for setting up request execution. The HTTP API may return errors while running.
Query
GET
-query to /queries/{query_id}/results/{<query_execution_result_number_starting_with_0>}?project={folder_id}
, where {folder_id}
is the folder ID, and the {query_id}
is the query ID.
Parameters are provided in URLs as query parameters.
Parameter | Description | Default value | Limitations |
---|---|---|---|
offset |
Number of the result array string to get query results from | 0 | Cannot be negative |
limit |
Number of result rows | 100 | The value must be from 1 to 1,000. |
Response
If successful, an HTTP response with code 200 and query execution results is returned.
{
"columns": [
{
"name": "column0",
"type": "Int32"
},
{
"name": "column1",
"type": "Int32"
}
],
"rows": [
[
"1",
"2"
],
[
"3",
"4"
]
]
}
Field | Description |
---|---|
columns |
Array of returned value columns |
columns[].name |
Column name |
columns[].type |
Column data type |
rows |
Array of result rows with the returned value. The number of array elements of each row is the same as the number of columns from the columns parameter. |
The rules for converting YQL data types to JSON-compatible data types are described in the Correspondence of YQL and JSON types section.
Example
Query:
curl -X 'GET' \
'https://api.yandex-query.cloud.yandex.net/api/fq/v1/queries/cseugn35bc3r********/results/0?project=b1gaue5b382m********&offset=0&limit=100' \
-H 'accept: application/json'
Response:
{
"columns": [
{
"name": "column0",
"type": "Int32"
},
{
"name": "column1",
"type": "Int32"
}
],
"rows": [
[
"1",
"2"
],
[
"3",
"4"
]
]
}