# Get Twin Doc

This endpoint retrieves the details od the given Doc. You can include the optional query string parameter "download" in the request to generate a temporary download URL to download the Doc in .zip format.

NOTE

The download URL is temporary and expires after 60 minutes. After the URL has expired, you will need to generate a new download URL. After the download URL has been generated, you need to send a GET request to that URL to download the given Doc.

Method Path Operation*
GET /twins/{twin}/docs/{doc_name} get_twin_doc

*

In order for a user to perform the "get_twin_doc" operation, the "get_twin_doc" permission must be included in the list of allowed actions in the statement of the user's role.

# Request

Parameter Type In Description
{twin}
required
string path Twin UUID.
doc_name
required
string path Name of the Doc. It must match the regular expression(opens new window) ^([a-zA-Z0-9_-]{1,32}\/){0,5}([a-zA-Z0-9_-]{1,32})(.[a-zA-Z0-9]{1,8})?$. It must be unique in the context of the Twin.
download
optional *
boolean, DEFAULT=False query string Denotes whether to return a download URL or not. The download URL is a temporary URL allowing to download a copy of the Doc.
validity_ts
optional **
timestamp query string Time at which the download URL expires. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window). If not provided, the download URL expires 60 minutes after it has been generated.

*

The "download" parameter is optional and does not need to be included in the request. If it is not included, its default value is used.

**

The "validity_ts" parameter is optional and does not need to be included in the request. If it is not included in the request, but the download parameter is set to True, the download URL expires 60 minutes after it has been generated.

# Response

Attribute Type Description
creation_certificate dictionary
Certificate generated automatically by the system upon sending a request to copy the Doc (attach_twin_doc endpoint). It cannot be modified after it has been generated.
Attribute Type Description
created_ts timestamp Time at which the Doc was created. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window).
creator string Account UUID of the account creating the Doc.
hash * string SHA-256 hash(opens new window).
size integer Size of the Doc in bytes.
storage_class string, value can be "access_optimized" or "cost_optimized" Storage class of the Doc:
- "access_optimized": Storage class for frequently accessed data.
- "cost_optimized": Storage class for automatic cost savings for less frequently accessed data.
Once the Doc has been copied and attached to a Twin, the "storage_class" cannot be changed.
status string, value can be "copying", "ok", "error", or "hash_mismatch" Status of the Doc:
- "copying": The Doc is in the process of being copied.
- "ok": The copy of the Doc has been successfully generated. It is attached to the Twin and stored in the Twin's directory.
- "hash_mismatch": The "hash" provided in the request does not match the hash of the Doc. A copy of the Doc could not be generated.
- "error": An error occurred and a copy of the Doc could not be generated.
updated_ts timestamp Time at which the Doc was last updated. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window).
description dictionary User-defined key-value pairs:
- key: It must match the regular expression(opens new window) ^[a-z_][0-9a-z_]{0,63}$.
- value: JSON compliant value.
For more details consult the description field section.
download dictionary
Holds the temporary download URL and the validity of the download URL.
Attribute Type Description
validity_ts timestamp Time at which the download URL expires. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window).
url string Download URL for the Doc.

*

The "hash" attribute is only displayed in the "creation_certificate" if it was provided in the request to attach the Doc to the given Twin attach_twin_doc endpoint.

# GET request

In order to access the Doc, you need to download it by sending a GET request to the download URL.

# Status codes

Requests to this endpoint result in generic status codes. For a comprehensive list of status codes, please consult the Status codes section.

Was this article helpful?