To integrate a dataset as a data source, you will utilize the API by authenticating with an API key, specifying your organization ID, and identifying the desired dataset. Use the following cURL command to request a dataset URL for "Statuses":
curl --location 'https://developer.finalcad.cloud/api/organizations/your_organization_id/data/config/dataseturl?name=dataset_name' \
--header 'X-API-Key: your_api_key'The endpoint responds with a URL in JSON format:
{
"url": "https://medias....LSEQ"
}With the dataset URL, proceed to Power BI to use this endpoint directly as a data source. The script below downloads the dataset file from the URL and includes a retry mechanism to handle any request errors. This setup ensures data is retrieved reliably even if there are temporary issues with the connection.
Here the Power BI blank query:
let
// Replace these variables with your own information
dataset_name = "dataset_name",
api_key = "your_api_key",
organization_id = "your_organization_id",
RetryRequest = (retries as number) =>
let
apiResponse = try Json.Document(Web.Contents("https://developer.finalcad.cloud/api/organizations/" & organization_id & "/data/config/dataseturl?name=" & dataset_name,
[Headers=[#"X-API-Key"= api_key, Authorization="token " & api_key]])),
Source = if apiResponse[HasError] and retries > 0 then
Function.InvokeAfter(() => @RetryRequest(retries - 1), #duration(0, 0, 0, 2))
else Parquet.Document(Binary.Buffer(Web.Contents(apiResponse[Value][url])))
in
Source,
Source = RetryRequest(3)
in
SourceThe dataset is now successfully loaded and will include all data, including historical records if available, with one row per creation and update of each entity.