Using a pi Component as a data endpoint with the pi API

Create a table in pi that you want to use as an API Endpoint, similar to the one shown below:

After saving the table, click the ‘Chart information’ in Chart Tools. 

You will need to make a note of the chart ID, which is highlighted in the following screenshot.

We are now going to use the pi API to fetch the chart – the example is JSON, but you can get any of the following – you’ll just need to remember to adapt the URL shown below.

https://app.swaggerhub.com/apis-docs/panintelligence/dashboard/2022_06_30.1#/charts/get_charts__id__json

Now the example calls in postman. We need to get an authorization token, as shown below:

We then call the endpoint for the chart, using the chart id, and we pass the token received back from the auth request above in a header.