# Genie Get Download Full Query Result

Launch stage: GA

`GET /api/2.0/genie/spaces/{space_id}/conversations/{conversation_id}/messages/{message_id}/attachments/{attachment_id}/downloads/{download_id}`

After Generating a Full Query Result Download and successfully receiving a `download_id` and `download_id_signature`, use this API to poll the download progress.
 Both `download_id` and `download_id_signature` are required to call this endpoint. 
 When the download is complete, the API returns the result in the `EXTERNAL_LINKS` disposition, containing one or more external links to the query result files.

 ----

 ### **Warning: Databricks strongly recommends that you protect the URLs that are returned by the `EXTERNAL_LINKS` disposition.**

 When you use the `EXTERNAL_LINKS` disposition, a
 short-lived,  URL is generated, which can be
 used to download the results directly
 from . As a
 short-lived  is
 embedded in this  URL, you should protect
 the URL.

 Because  URLs are already generated with
 embedded temporary s,
 you must not set an `Authorization` header in the download requests.

 See Execute Statement for more details.

 ----

API scopes: genie

**AWS**

After Generating a Full Query Result Download and successfully receiving a `download_id` and `download_id_signature`, use this API to poll the download progress.
Both `download_id` and `download_id_signature` are required to call this endpoint.
When the download is complete, the API returns the result in the `EXTERNAL_LINKS` disposition, containing one or more external links to the query result files.

----

### **Warning: Databricks strongly recommends that you protect the URLs that are returned by the `EXTERNAL_LINKS` disposition.**

When you use the `EXTERNAL_LINKS` disposition, a
short-lived, presigned URL is generated, which can be
used to download the results directly
from Amazon S3. As a
short-lived access credential is
embedded in this presigned URL, you should protect
the URL.

Because presigned URLs are already generated with
embedded temporary access credentials,
you must not set an `Authorization` header in the download requests.

See Execute Statement for more details.

----

**Azure**

After Generating a Full Query Result Download and successfully receiving a `download_id` and `download_id_signature`, use this API to poll the download progress.
Both `download_id` and `download_id_signature` are required to call this endpoint.
When the download is complete, the API returns the result in the `EXTERNAL_LINKS` disposition, containing one or more external links to the query result files.

----

### **Warning: Databricks strongly recommends that you protect the URLs that are returned by the `EXTERNAL_LINKS` disposition.**

When you use the `EXTERNAL_LINKS` disposition, a
short-lived, SAS URL is generated, which can be
used to download the results directly
from Azure storage. As a
short-lived SAS token is
embedded in this SAS URL, you should protect
the URL.

Because SAS URLs are already generated with
embedded temporary SAS tokens,
you must not set an `Authorization` header in the download requests.

See Execute Statement for more details.

----

**GCP**

After Generating a Full Query Result Download and successfully receiving a `download_id` and `download_id_signature`, use this API to poll the download progress.
Both `download_id` and `download_id_signature` are required to call this endpoint.
When the download is complete, the API returns the result in the `EXTERNAL_LINKS` disposition, containing one or more external links to the query result files.

----

### **Warning: Databricks strongly recommends that you protect the URLs that are returned by the `EXTERNAL_LINKS` disposition.**

When you use the `EXTERNAL_LINKS` disposition, a
short-lived, signed URL is generated, which can be
used to download the results directly
from Google Cloud Storage. As a
short-lived access credential is
embedded in this signed URL, you should protect
the URL.

Because signed URLs are already generated with
embedded temporary access credentials,
you must not set an `Authorization` header in the download requests.

See Execute Statement for more details.

----

## Path parameters

- `space_id` (string, optional)
  Genie space ID
  Example: `e1ef34712a29169db030324fd0e1df5f`
- `conversation_id` (string, optional)
  Conversation ID
  Example: `e1ef34712a29169db030324fd0e1df5f`
- `message_id` (string, optional)
  Message ID
  Example: `e1ef34712a29169db030324fd0e1df5f`
- `attachment_id` (string, optional)
  Attachment ID
  Example: `e1ef34712a29169db030324fd0e1df5f`
- `download_id` (string, optional)
  Download ID. This ID is provided by the [Generate Download endpoint](:method:genie/generateDownloadFullQueryResult)
  Example: `01eda0e7-e315-1846-84e2-79a963ffad44`

## Query parameters

- `download_id_signature` (string, optional)
  JWT signature for the download_id to ensure secure access to query results

## Returns

- `statement_response` (object, optional)
  SQL Statement Execution response. See [Get status, manifest, and result first chunk](:method:statementexecution/getstatement) for more details.
  - `statement_id` (string, optional)
    The statement ID is returned upon successfully submitting a SQL statement, and is a required
     reference for all subsequent calls.
  - `status` (object, optional)
    - `state` (string, optional)
      Statement execution state:
       - `PENDING`: waiting for warehouse
       - `RUNNING`: running
       - `SUCCEEDED`: execution was successful, result data available for fetch
       - `FAILED`: execution failed; reason for failure described in accompanying error message
       - `CANCELED`: user canceled; can come from explicit cancel call, or timeout with
       `on_wait_timeout=CANCEL`
       - `CLOSED`: execution successful, and statement closed; result no longer available for fetch
      Possible values: `STATE_UNSPECIFIED`, `PENDING`, `RUNNING`, `SUCCEEDED`, `FAILED`, `CANCELED`, `CLOSED`
    - `error` (object, optional)
      - `error_code` (string, optional)
        Possible values: `UNKNOWN`, `INTERNAL_ERROR`, `TEMPORARILY_UNAVAILABLE`, `IO_ERROR`, `BAD_REQUEST`, `SERVICE_UNDER_MAINTENANCE`, `WORKSPACE_TEMPORARILY_UNAVAILABLE`, `DEADLINE_EXCEEDED`, `CANCELLED`, `RESOURCE_EXHAUSTED`, `ABORTED`, `NOT_FOUND`, `ALREADY_EXISTS`, `UNAUTHENTICATED`, `UNAVAILABLE`, `INVALID_PARAMETER_VALUE`, `ENDPOINT_NOT_FOUND`, `MALFORMED_REQUEST`, `INVALID_STATE`, `PERMISSION_DENIED`, `FEATURE_DISABLED`, `CUSTOMER_UNAUTHORIZED`, `REQUEST_LIMIT_EXCEEDED`, `RESOURCE_CONFLICT`, `UNPARSEABLE_HTTP_ERROR`, `NOT_IMPLEMENTED`, `DATA_LOSS`, `INVALID_STATE_TRANSITION`, `COULD_NOT_ACQUIRE_LOCK`, `RESOURCE_ALREADY_EXISTS`, `RESOURCE_DOES_NOT_EXIST`, `QUOTA_EXCEEDED`, `MAX_BLOCK_SIZE_EXCEEDED`, `MAX_READ_SIZE_EXCEEDED`, `PARTIAL_DELETE`, `MAX_LIST_SIZE_EXCEEDED`, `DRY_RUN_FAILED`, `RESOURCE_LIMIT_EXCEEDED`, `DIRECTORY_NOT_EMPTY`, `DIRECTORY_PROTECTED`, `MAX_NOTEBOOK_SIZE_EXCEEDED`, `MAX_CHILD_NODE_SIZE_EXCEEDED`, `SEARCH_QUERY_TOO_LONG`, `SEARCH_QUERY_TOO_SHORT`, `MANAGED_RESOURCE_GROUP_DOES_NOT_EXIST`, `PERMISSION_NOT_PROPAGATED`, `DEPLOYMENT_TIMEOUT`, `GIT_CONFLICT`, `GIT_UNKNOWN_REF`, `GIT_SENSITIVE_TOKEN_DETECTED`, `GIT_URL_NOT_ON_ALLOW_LIST`, `GIT_REMOTE_ERROR`, `PROJECTS_OPERATION_TIMEOUT`, `IPYNB_FILE_IN_REPO`, `INSECURE_PARTNER_RESPONSE`, `MALFORMED_PARTNER_RESPONSE`, `METASTORE_DOES_NOT_EXIST`, `DAC_DOES_NOT_EXIST`, `CATALOG_DOES_NOT_EXIST`, `SCHEMA_DOES_NOT_EXIST`, `TABLE_DOES_NOT_EXIST`, `SHARE_DOES_NOT_EXIST`, `RECIPIENT_DOES_NOT_EXIST`, `STORAGE_CREDENTIAL_DOES_NOT_EXIST`, `EXTERNAL_LOCATION_DOES_NOT_EXIST`, `PRINCIPAL_DOES_NOT_EXIST`, `PROVIDER_DOES_NOT_EXIST`, `METASTORE_ALREADY_EXISTS`, `DAC_ALREADY_EXISTS`, `CATALOG_ALREADY_EXISTS`, `SCHEMA_ALREADY_EXISTS`, `TABLE_ALREADY_EXISTS`, `SHARE_ALREADY_EXISTS`, `RECIPIENT_ALREADY_EXISTS`, `STORAGE_CREDENTIAL_ALREADY_EXISTS`, `EXTERNAL_LOCATION_ALREADY_EXISTS`, `PROVIDER_ALREADY_EXISTS`, `CATALOG_NOT_EMPTY`, `SCHEMA_NOT_EMPTY`, `METASTORE_NOT_EMPTY`, `PROVIDER_SHARE_NOT_ACCESSIBLE`
      - `message` (string, optional)
      - `stack_trace` (string, optional)
    - `sql_state` (string, optional)
      SQLSTATE error code returned when the statement execution fails.
       Only populated when the statement status is `FAILED`.
  - `manifest` (object, optional)
    - `format` (string, optional)
      Possible values: `FORMAT_UNSPECIFIED`, `JSON_ARRAY`, `ARROW_STREAM`, `CSV`
    - `schema` (object, optional)
      - `column_count` (int32, optional)
      - `columns` (array of object, optional)
    - `total_chunk_count` (int32, optional)
      The total number of chunks that the result set has been divided into.
    - `chunks` (array of object, optional)
      Array of result set chunk metadata.
      - `chunk_index` (int32, optional)
        The position within the sequence of result set chunks.
      - `row_offset` (int64, optional)
        The starting row offset within the result set.
      - `row_count` (int64, optional)
        The number of rows within the result chunk.
      - `byte_count` (int64, optional)
        The number of bytes in the result chunk. This field is not available when using `INLINE`
         disposition.
      - `next_chunk_index` (int32, optional)
        When fetching, provides the `chunk_index` for the _next_ chunk. If absent, indicates there are no
         more chunks. The next chunk can be fetched with a
         :method:statementexecution/getstatementresultchunkn request.
      - `next_chunk_internal_link` (string, optional)
        When fetching, provides a link to fetch the _next_ chunk. If absent, indicates there are no more
         chunks. This link is an absolute `path` to be joined with your `$DATABRICKS_HOST`, and should be
         treated as an opaque link. This is an alternative to using `next_chunk_index`.
    - `total_row_count` (int64, optional)
      The total number of rows in the result set.
    - `total_byte_count` (int64, optional)
      The total number of bytes in the result set. This field is not available when using `INLINE`
       disposition.
    - `truncated` (boolean, optional)
      Indicates whether the result is truncated due to `row_limit` or `byte_limit`.
  - `result` (object, optional)
    - `external_links` (array of object, optional)
      - `external_link` (string, optional)
        A  URL pointing to a
         chunk of result data, hosted by an external service, with a short expiration time
         (<= 15 minutes). As this URL contains a temporary credential, it should be considered sensitive
         and the client should not expose this URL in a log.
        **AWS:** A presigned URL pointing to a
        chunk of result data, hosted by an external service, with a short expiration time
        (<= 15 minutes). As this URL contains a temporary credential, it should be considered sensitive
        and the client should not expose this URL in a log.
        **Azure:** A SAS URL pointing to a
        chunk of result data, hosted by an external service, with a short expiration time
        (<= 15 minutes). As this URL contains a temporary credential, it should be considered sensitive
        and the client should not expose this URL in a log.
        **GCP:** A signed URL pointing to a
        chunk of result data, hosted by an external service, with a short expiration time
        (<= 15 minutes). As this URL contains a temporary credential, it should be considered sensitive
        and the client should not expose this URL in a log.
      - `expiration` (string, optional)
        Indicates the date-time that the given external link will expire and
         becomes invalid, after which point a new `external_link` must be requested.
      - `chunk_index` (int32, optional)
        The position within the sequence of result set chunks.
      - `row_offset` (int64, optional)
        The starting row offset within the result set.
      - `row_count` (int64, optional)
        The number of rows within the result chunk.
      - `byte_count` (int64, optional)
        The number of bytes in the result chunk. This field is not available when using `INLINE`
         disposition.
      - `next_chunk_index` (int32, optional)
        When fetching, provides the `chunk_index` for the _next_ chunk. If absent, indicates there are no
         more chunks. The next chunk can be fetched with a
         :method:statementexecution/getstatementresultchunkn request.
      - `next_chunk_internal_link` (string, optional)
        When fetching, provides a link to fetch the _next_ chunk. If absent, indicates there are no more
         chunks. This link is an absolute `path` to be joined with your `$DATABRICKS_HOST`, and should be
         treated as an opaque link. This is an alternative to using `next_chunk_index`.
    - `data_array` (array of object, optional)
      The `JSON_ARRAY` format is an array of arrays of values, where each non-null value is
       formatted as a string. Null values are encoded as JSON `null`.
      - `values` (array of object, optional)
        Repeated field of dynamically typed values.
    - `chunk_index` (int32, optional)
      The position within the sequence of result set chunks.
    - `row_offset` (int64, optional)
      The starting row offset within the result set.
    - `row_count` (int64, optional)
      The number of rows within the result chunk.
    - `byte_count` (int64, optional)
      The number of bytes in the result chunk. This field is not available when using `INLINE`
       disposition.
    - `next_chunk_index` (int32, optional)
      When fetching, provides the `chunk_index` for the _next_ chunk. If absent, indicates there are no
       more chunks. The next chunk can be fetched with a
       :method:statementexecution/getstatementresultchunkn request.
    - `next_chunk_internal_link` (string, optional)
      When fetching, provides a link to fetch the _next_ chunk. If absent, indicates there are no more
       chunks. This link is an absolute `path` to be joined with your `$DATABRICKS_HOST`, and should be
       treated as an opaque link. This is an alternative to using `next_chunk_index`.

## Response

```json
{
  "statement_response": {
    "statement_id": "string",
    "status": {},
    "manifest": {},
    "result": {}
  }
}
```

