Zum Hauptinhalt wechseln

Power BI REST API functions

This article details the available Power BI REST API functions you can use with the Cognite APIs.

Beta

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.

ParameterTypeDescription
urlTextThe 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.

ParameterTypeDescription
urlTextThe URL path to make the request, starting directly after the project name. For example, "/timeseries/list", "/assets/list".
bodyTextA 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 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 JSON body, the function will return an error of type CogniteConnectorError.
note

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.

ParameterTypeDescription
spaceTextThe external ID of the data model space.
datamodelTextThe external ID of the data model.
versionTextThe version of the data model.
queryTextA text representation of the GraphQL query to send when making the request. Include 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 GraphQL query, the function returns an error of type CogniteAPIError.
variablesTextA text representation of the JSON variables to send when making the request.
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.
note

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.

ParameterTypeDescription
urlTextThe URL path to the OData request, including the project name. For examples, "publicdata", "publicdata/Timeseries".
apiVersionText (optional)The API version of the OData service to use with the request. The default value is "v1". The latest version of the asset-centric OData service is "v1". For the data modeling OData service, the latest version is "20230821".

ODataDataModel

Use this funtion to fetch data from a CDF data model using the data modeling OData service.

ParameterTypeDescription
spaceTextThe external ID of the data model space.
datamodelTextThe external ID of the data model.
versionTextThe version of the data model.
apiVersionText (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".