Salt la conținutul principal

Power BI REST API functions

This article details the available Power BI REST API functions.

Beta

The features described in this section are currently in beta testing with selected customers and are subject to change.

GetCDF

Use this function to fetch data from CDF APIs using the HTTP GET method. The function auto-paginates CDF until the request cursor is exhausted. To ensure optimal performance, see the Cognite API specification 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 right after the project name. Examples: "/timeseries", "/assets".

PostCDF

Use this function to fetch data from CDF APIs using the HTTP POST method. The function auto-paginates CDF until the request cursor is exhausted. To ensure optimal performance, see the Cognite API specification for endpoints that support this HTTP method.

ParameterTypeDescription
urlTextThe URL path to make the request, starting right after the project name. Examples: "/timeseries/list", "/assets/list".
bodyTextA text representation of the JSON body to send with the request. Examples: "{}", "{"limit": 1000}". When available, set the limit parameter to the maximum supported value for the endpoint. See the Cognite API specification for optimal performance. 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.
notă

The PostCDF function offers auto-pagination for simple requests that expect a cursor at the top level of the request body. For more complex requests, you need to write a custom pagination logic using the Power Query M language. See the article on 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. 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. Example: "{""country"": ""Norway""}". Don't include the cursor variable in the variables parameter. It is automatically managed by the connector. If you provide an invalid JSON body, the function returns an error of type CogniteConnectorError.
notă

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, you need to write a custom pagination logic using the Power Query M language. See also the Power Query functions and example queries article. Before using the queries and variables in Power BI, always test them with the 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. Examples: "publicdata", "publicdata/Timeseries".
apiVersionText (optional)The API version of the OData service to use with the request. Default: "v1". The latest version of the asset-centric OData service is "v1". For the data modeling OData service, the latest version is "20230821".

ODataDataModel

Fetch data from a data model in CDF 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. Default: "20230821". The latest version of the data modeling OData service is "20230821".