Power BI REST API functions
This article details the available Power BI REST API functions you can use with the Cognite APIs.
The features described in this section are currently in beta and are subject to change.
GetCDF
Use this function to fetch data from Cognite APIs using the HTTP GET method. The function auto-paginates CDF until the request cursor is exhausted. For optimal performance, see the Cognite API specifications for endpoints that support this HTTP method and the maximum supported page size for each endpoint.
Parameter | Type | Description |
---|---|---|
url | Text | The URL path to make the request, starting directly after the project name. For example, "/timeseries" , "/assets" . |
PostCDF
Use this function to fetch data from Cognite APIs using the HTTP POST method. The function auto-paginates CDF until the request cursor is exhausted. For optimal performance, see the Cognite API specifications for endpoints that support this HTTP method.
Parameter | Type | Description |
---|---|---|
url | Text | The URL path to make the request, starting directly after the project name. For example, "/timeseries/list" , "/assets/list" . |
body | Text | A text representation of the JSON body to send with the request. For example, "{}" , "{"limit": 1000}" . When available, set the limit parameter to the maximum supported value for the endpoint. For optimal performance, see the Cognite API specifications. When invoking this function with CogniteConnectorError . |
The PostCDF
function offers auto-pagination for simple requests that expect a cursor
field (string
) at the top level of the request body. For more complex requests, write a custom pagination logic using the Power Query M language. See Power Query functions and example queries.
GraphQL
Use this function to fetch data from a CDF data model using GraphQL.
Parameter | Type | Description |
---|---|---|
space | Text | The external ID of the data model space. |
datamodel | Text | The external ID of the data model. |
version | Text | The version of the data model. |
query | Text | A text representation of the after:$cursor and pageInfo { hasNextPage endCursor } in the query to enable auto-pagination. Consider setting the first parameter to 1000 (maximum supported limit) for optimal performance. For example, "query MyQuery($cursor: String) { listMovies(first: 1000, after: $cursor) { items { name } pageInfo { endCursor hasNextPage }}}" . When invoking this function with Power BI, the query is presented as a multiline text area. You don't need to escape double quote characters. If you provide an invalid CogniteAPIError . |
variables | Text | A text representation of the For example, "{""country"": ""Norway""}" . Don't include the cursor variable in the variables parameter, since this is automatically managed by the connector. If you provide an invalid JSON body, the function returns an error of type CogniteConnectorError . |
The GraphQL function offers auto-pagination for GraphQL queries that include only one query expression with one pagination target, identified by the after: $cursor
and pageInfo { hasNextPage endCursor }
fields.
For more complex queries, write a custom pagination logic using the Power Query M language. See Power Query functions and example queries. Always test the queries and variables in Power BI with CDF Query Explorer to ensure they're correct.
ODataCDF
Use this function to fetch data from the Cognite OData services.
Parameter | Type | Description |
---|---|---|
url | Text | The URL path to the "publicdata" , "publicdata/Timeseries" . |
apiVersion | Text (optional) | The API version of the "v1" . The latest version of the asset-centric OData service is "v1" . For the data modeling "20230821" . |
ODataDataModel
Use this funtion to fetch data from a CDF data model using the data modeling OData service.
Parameter | Type | Description |
---|---|---|
space | Text | The external ID of the data model space. |
datamodel | Text | The external ID of the data model. |
version | Text | The version of the data model. |
apiVersion | Text (optional) | The API version of the OData service to use when making the request. The default value is "20230821" . The latest version of the data modeling OData service is "20230821" . |