- Standardized query syntax: Enables consistent filtering, sorting, pagination, and projections across different data sources.
- Metadata support: Clients can discover the data structure and types via metadata documents.
- Interoperability: Any client that supports HTTP and understands OData can consume OData services.
Using the OData services
To interact with the Cognite OData services, you make HTTP GET requests to specific endpoints.Authenticate
To authenticate with the OData services, you must include a bearer token in the authorization header of your HTTP requests. For example:Make requests
Example GET request
To retrieve all assets in a project:{cluster}: The CDF cluster name (e.g., westeurope-1).{apiVersion}: The OData service API version (e.g., v1).{project}: Your CDF project name.
Query parameters
Use query parameters to filter, sort, select, and paginate data.-
Filtering - use the
$filterquery parameter to filter data. Example: Retrieve assets whereNameequals'Pump 1':GET .../Assets?$filter=Name eq 'Pump 1' -
Selecting fields- use the
$selectquery parameter to retrieve specific fields. Example: Retrieve only theIdandNameof assets:GET .../Assets?$select=Id,Name -
Sorting - use the
$orderbyquery parameter to sort results. Example: Order assets byNameascending:GET .../Assets?$orderby=Name asc -
Expanding related entities - use the
$expandquery parameter to include related entities. Example: Retrieve an asset along with its parent:GET .../Assets(702630644612)/Parent?$expand=ParentNote: Not all entities and relationships support expansion. Refer to the individual service documentation for details. -
Combining query parameters - you can combine multiple query parameters to refine your request.
Example: Retrieve the
IdandNameof assets whereNamestarts with'Pump', ordered byName, and retrieve the first 10 results:GET .../Assets?$filter=startswith(Name,'Pump')&$select=Id,Name&$orderby=Name asc&$top=10
Response format
The OData services return responses in JSON format, following the OData V4 standard. Example response:Pagination in responses
The OData service may paginate the response for large result sets. The response includes a@odata.nextLink property with a URL to retrieve the next page of results.
Example: