> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognite.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cognite OData services

> Fetch data from Cognite Data Fusion using OData clients such as Microsoft Power BI, Microsoft Excel, and TIBCO Spotfire.

**<span translate="no">Open Data Protocol (OData)</span>** is an open standard defining best practices for building and consuming RESTful APIs. <span translate="no">OData</span> offers:

* **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 <span translate="no">OData</span> can consume <span translate="no">OData</span> services.

Cognite provides an [**asset-centric <span translate="no">OData</span> service**](/cdf/dashboards/references/odata/classic_odata) and a [**data-modeling <span translate="no">OData</span> service**](/cdf/dashboards/references/odata/dm_odata). Both services wrap the standard <span translate="no">Cognite</span> APIs, implementing an <span translate="no">OData Version 4 API</span> for read-only purposes. They translate <span translate="no">OData</span> requests into corresponding <span translate="no">Cognite API</span> calls, allowing you to interact with <span translate="no">CDF</span> data using <span translate="no">OData</span>-compatible clients and tools.

<a id="using-the-odata-services" />

## Using the <span translate="no">OData</span> services

To interact with the <span translate="no">Cognite</span> <span translate="no">OData</span> services, you make HTTP GET requests to specific endpoints.

<a id="authenticate" />

### Authenticate

To authenticate with the <span translate="no">OData</span> services, you must include a bearer token in the authorization header of your HTTP requests.

For example:

```
Authorization: Bearer {YourAccessToken}
```

You can obtain an access token using the appropriate authentication flow for your setup (e.g., OAuth 2.0, OpenID Connect). For more details, refer to the [Authentication documentation](/cdf/access/concepts/authentication_flows_oidc).

<a id="make-requests" />

### Make requests

<a id="example-get-request" />

##### Example GET request

To retrieve all assets in a project:

```
GET https://{cluster}.cognitedata.com/odata/{apiVersion}/projects/{project}/Assets
```

Where:

* `{cluster}`: The <span translate="no">CDF</span> cluster name (e.g., westeurope-1).
* `{apiVersion}`: The <span translate="no">OData</span> service API version (e.g., v1).
* `{project}`: Your <span translate="no">CDF</span> project name.

<a id="query-parameters" />

##### Query parameters

Use query parameters to filter, sort, select, and paginate data.

* **Filtering** - use the `$filter` query parameter to filter data.

  *Example*: Retrieve assets where `Name` equals `'Pump 1'`: `GET .../Assets?$filter=Name eq 'Pump 1'`

* **Selecting fields**- use the `$select` query parameter to retrieve specific fields.

  *Example*: Retrieve only the `Id` and `Name` of assets: `GET .../Assets?$select=Id,Name`

* **Sorting** - use the `$orderby` query parameter to sort results.

  *Example*: Order assets by `Name` ascending: `GET .../Assets?$orderby=Name asc`

* **Expanding related entities** - use the `$expand` query parameter to include related entities.
  *Example*: Retrieve an asset along with its parent: `GET .../Assets(702630644612)/Parent?$expand=Parent`

  **Note**: Not all entities and relationships support expansion. Refer to the individual [service documentation](/api-reference/concepts/20230101/api-description) for details.

* **Combining query parameters** - you can combine multiple query parameters to refine your request.

  *Example*: Retrieve the `Id` and `Name` of assets where `Name` starts with `'Pump'`, ordered by `Name`, and retrieve the first 10 results:
  `GET .../Assets?$filter=startswith(Name,'Pump')&$select=Id,Name&$orderby=Name asc&$top=10`

<a id="response-format" />

##### Response format

The <span translate="no">OData</span> services return responses in JSON format, following the <span translate="no">OData</span> V4 standard.

Example response:

```json theme={"languages":{"custom":["/_languages/kuiper.json","../_languages/kuiper.json"]}}
{
  "@odata.context": "https://{cluster}.cognitedata.com/odata/{apiVersion}/projects/{project}/$metadata#Assets/",
  "value": [
    {
      "Id": "12345",
      "DataSetId": null,
      "ExternalId": "WMT:VAL",
      "Name": "Pump 1",
      "Description": "Main pump"
      // other properties
    }
  ]
}
```

<a id="pagination-in-responses" />

##### 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:

```json theme={"languages":{"custom":["/_languages/kuiper.json","../_languages/kuiper.json"]}}
{
  "@odata.context": "https://{cluster}.cognitedata.com/odata/{apiVersion}/projects/{project}/$metadata#Assets",
  "value": [ // records ],
  "@odata.nextLink": "https://{cluster}.cognitedata.com/odata/{apiVersion}/projects/{project}/Assets?$skipToken=123"
}
```

<a id="limitations-and-supported-features" />

### Limitations and supported features

The <span translate="no">OData</span> services aim to conform to the <span translate="no">OData</span> V4 standard, but some features may be limited or unsupported due to underlying constraints of the <span translate="no">Cognite</span> APIs.

Refer to the individual [service documentation](/api-reference/concepts/20230101/api-description) for detailed information on supported features and limitations.
