# Power BI Integration
To connect to Petro.ai from Power BI you will need to create a queries in Power Query Editor.
# Get data
To do this, start by selecting Get Data from Power BI Desktop.
Once inside the web dialog, you'll need to input the components of the Petro.ai API endpoint that you want to communicate with. In this example, we are connecting to the Wells collection, drawing only 10 into Power BI.
TIP
Authentication is usually the most difficult part of connecting to an API. We make this simple by providing the API keys on portal.petro.ai. Sign in to find your key.
Component | Description |
---|---|
URL parts | This is where you will input the name of the server as well as the collection that you are trying to reach. Use the API documentation to see the strings used. Usually they will be constructed as /wells or /completiondatapoints. |
HTTP request header parameters | Although optional for Power BI, to connect to Petro.ai you will need a bearer token. You can find your token on portal.petro.ai and you'll enter it here as Bearer e5kd4i3gu2tj23e47ke..... |
When it first processes, Power BI may try to store your credentials. These are already stored in the Bearer token.
# Navigate to the table
Once inside the query, we'll need to flatten the table to something that Power BI can use.
- Inside the Power Query Editor, click
List
at the top. - From the ribbon click Into Table.
- In the top right of the table, click the Expand icon.
- Close and apply your changes.
# Wrap up
You now have a live table from Petro.ai pulling from the API endpoint. Configure the data source so that table will update continously from the endpoint.