Power BI API
Valid from 30th May 2022
Updated over a week ago

The Power BI API provides teams a powerful and direct way to extract and visualise data from their Aphex projects.

The Power BI API has three components.

Power BI Setup Guide

If you are looking for the quick guide to setting up Power BI for your project, check out this guide here

Authentication

You can access the Power BI API by querying the endpoint URL for your desired project and providing a valid Token.

Finding your API URL

As a Project Administrator, head to your project in the Aphex Planner app (jump here for navigation guides). From the Integrations page the API can be enabled.

This will uncover the API URL specific to that project. The URL structure will be;

https://data.aphex.co/power-bi/v1/<your_api_account_id>

Generating Tokens

From the same location you sourced the API URL, a new Token created. Create a new Token and name it i.e. Project Dashboard Token 1

Secret Token


You cannot retrieve the token later so you should save it in a secret manager. If you lose the token you can generate a new one.

Querying the API

To successfully authenticate your request to the API URL, set the Token in the Authorization header of the request.

This can be done three ways;

1. If you are using an Aphex Power BI Template simply paste the URL and Token into the setup modal

2. If you are generating your own report in Power BI, set up a new "Web" source. From within the Advanced menu enter the URL and header request key of Authorization with Bearer followed by your Token as the value.

3. If you are consuming the data in any other service construct a valid cURL request (example below).

curl \
-X GET \
-H "Authorization: Bearer $<your_token>" \
https://data.aphex.co/power-bi/v1/<your_API_account_id_here>

Query Parameters

To enable projects of varying size to get the most out of this API within the single response limit of 32Mb the following query parameters are supported;

Parameter

Description

Limit

limit=number

This parameter will determine how many of the historical published versions are returned. If not provided, the response will default to 5

Status

status=boolean

This parameter will determine whether status events are included in the response. If not provided, the response will default to true

Resource

resource=boolean

This parameter will determine whether labour, plant and material assignments are included in the response. If not provided, the response will default to true

Data Model

Valid requests to the API will return a JSON response consistent with the API data model.

The Power BI API Data Model contains the following objects;

Object

Description

Publications

The Publications included within the response window. The API will return up to the five most recent Publications

Publication Summaries

The Owner breakdown for each Publication showing ready status and related data

Tasks

The unique Tasks included in the response

Task Version

The Versions of the Tasks included in each of the Publications along with all Task properties.

Status

All Status events on each of the Tasks at each of the Publications

Labour Resources

All Labour assigned on each of the Tasks at each of the Publications

Plant Resources

All Plant assigned on each of the Tasks at each of the Publications

Material Resources

All Materials assigned on each of the Tasks at each of the Publications

For a breakdown of the response tables and included fields, please view this board here.

Limits and Restrictions

The Power BI API has a small number of restrictions and limits to ensure the availability of the system and the security of customer data.

  • Token Management Restrictions: As covered in Authentication section, requests to the API will only succeed if they follow the correct request structure and include both a valid URL and Token. Tokens are generated individually for a Project, by a user with Project Admin rights.

  • Token Validity Limits: Generated tokens have a maximum lifespan of 3 months to ensure that over time, project data is secure by default. On expiry, or at any time, new tokens can be generated for the project.

  • Limits: To stay within infrastructure limits and avoid paged responses on this end point, a response limit of 32Mb exists. If you experience a server error, please try reducing you data request by passing in query parameters. There is also a hard data history limit of 6 months.

  • Fair Use Policy: The API endpoint is designed to support periodic (usually weekly) requests from projects. Use of the service outside that threatens the availability of the service for other projects could result in a suspension of the service for the offending project.

Did this answer your question?