Retrieve file metadata by id

async AsyncCogniteClient.files.retrieve(
id: int | None = None,
external_id: str | None = None,
instance_id: NodeId | None = None,
) FileMetadata | None

Retrieve a single file metadata by id.

Parameters:
  • id (int | None) – ID

  • external_id (str | None) – External ID

  • instance_id (NodeId | None) – Instance ID

Returns:

Requested file metadata or None if it does not exist.

Return type:

FileMetadata | None

Examples

Get file metadata by id:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> res = client.files.retrieve(id=1)

Get file metadata by external id:

>>> res = client.files.retrieve(external_id="1")