NOTE: Before starting this process, be sure you download the latest version of Postman here.
Probably the BEST way to understand how to work with the PI API is to use the Postman development tool. This app is SUPER-EASY to use, and I'm going to show you how quickly you can get at your API information in PI.
First thing you need to do is make sure you have a valid API token. There is a description of generating one here. You can find it Under the Administration > Integration link in the side bar:
After you have a token handy, open up Postman.
Next, in the top-left corner of Postman, click the New button:
Then, select REQUEST:
You will be prompted to name your request, and provide a description. (I recommend creating the query first and then organizing into project folders later.)
After you click Save, a new GET Request tab will display. This is your "scratch pad" for modifying and tweaking your JSON request to get what you need.
In my sample, I want to get All Users out of PI. So, I'm going to paste the appropriate end-point for that API--using my app URL--as the request URL. (Replace the "block" below with yours.)
After I put my URL end-point in the request URL field, I need to add my token information to my "header", which is just a name-value list of parameters that tells the server to do specific commands. In order to be allowed access, you minimally need to have the api-token header. (Replace the block below with your PI API Token):
Be sure you click Header vs. Params. Add api-token to KEY. Add your token to VALUE.
Upon clicking Send, you should receive a JSON list with the default properties of all your users:
This will help you "see" what's happening with your PI API calls and let you develop custom items, connected programs, syncing, etc... A LOT EASIER!
QUESTIONS? Need us to handle your integration? Contact me: email@example.com
Please sign in to leave a comment.