Postman is used by developers to easily send API request and it is a great tool used by many to test their API request responses. Postman makes it easy to automate test and create an organized workspace for you to test your API. Through their desktop client you can send any type of http request which you may find useful when wanting to test events and queries on a pico.
Choose the pico for which you want to raise a rule
For this example we will use the following rule found in io.picolabs.wrangler:
Find your ECI
Go to the pico’s “Channels“ tab and here you can find the different ECI’s (Event Channel Identifier) that the pico currently has. Choose an ECI with an appropriate policy id. In our example we are using the ECI with policy id of “allow-all-policy“ and type “wrangler“.
You can now place the request URL in the designated input field in Postman
Create request body
To create the request body, you are going to want to do the following:
click on the “Body“ tab
select the “raw“ bullet
choose JSON as the datatype
In the text block field you can now create your JSON body request like so
Send request and confirm result
You can send the request by hitting the “Send“ button
After hitting “Send“ you can now see the response below where you wrote the request body
You can see that the response contains directives that let me know that the child pico was created.
Querying a Pico on Postman
Create a Request Tab
Change Request Method to GET
Choose which pico, ruleset and function you want to query
Looking at your pico engine UI, decide which pico, which ruleset, and which function you want to query. I chose my ‘bus’ pico and the ‘uta_time’ ruleset. The function from this ruleset I chose is the ‘dayOfWeek’ function. Be sure the ruleset shares the function you want to test, otherwise you will get a 500 status when you query it along with the message “Not Shared”.
Find your ECI
Inside the pico that you want to query, go to the channels tab. Select an ECI with an appropriate policy.