Retrieve Unit

async AsyncCogniteClient.units.retrieve(
external_id: str | SequenceNotStr[str],
ignore_unknown_ids: bool = False,
) Unit | UnitList | None

Retrieve one or more unit.

Parameters:
  • external_id (str | SequenceNotStr[str]) – External ID or list of external IDs

  • ignore_unknown_ids (bool) – Ignore external IDs that are not found rather than throw an exception.

Returns:

If a single external ID is specified: the requested unit, or None if it does not exist. If several external IDs are specified: the requested units.

Return type:

Unit | UnitList | None

Examples

Retrive unit ‘temperature:deg_c’:

>>> from cognite.client import CogniteClient, AsyncCogniteClient
>>> client = CogniteClient()
>>> # async_client = AsyncCogniteClient()  # another option
>>> res = client.units.retrieve("temperature:deg_c")

Retrive units ‘temperature:deg_c’ and ‘pressure:bar’:

>>> res = client.units.retrieve(["temperature:deg_c", "pressure:bar"])