This is a guide to help you get your API data into your Niagara station using our InnonQuickApi for the first time!
We developed this module to help simplify the process of passing the data you need from the API’s you are using to your station. No need to decode the payload with the Quick API as the once the module has pulled the data from the API, it is broken down into slots. All you need to do from there is use the composite tool to expose the strings as slots, which is we will run through below.
-
Install the module in the relevant module folder for your version of workbench.
- Open the module in your palette, and drop the “QuickRestApi” block into your station.
- Go into the property sheet of the QuickRestApi block, and you will see the below:
From here you will need to get the endpoint of the API you are looking to use, as an example I am going to use an API that requires NoAuth (https://official-joke-api.appspot.com/random_joke). The module is compatible with the Basic/Bearer/Http and NoAuth for reference, this is configured in the authentication of the block. -
Now that you have defined the URL of the endpoint, we can now ping the connection (right click the QuickRestApi > Actions > Ping connection) to ensure that we are able to reach it. If this is successful you will see the below:
If not, it would be worth checking the setup of your web service, firewall (if your on a Supervisor) or router to see if the outgoing connectivity is being blocked by any of the above. - Now that we know that there is no issues with connecting to the endpoint, we can now send our request (right click the QuickRestApi > Actions > Send Request). For this example I have a Get request, Post is also supported. If the request is successful you should then see the data from the API appear as shown below:
Great! We have the data we want in our Niagara station. Now we want to be able to use that data in our station.
- To get the strings from the QuickRestApi block, we will need to use the composite tool. You will find this by right clicking the QuickRestApi block and selecting the below:
This will bring up the Composite Editor tool. From here you need to expand the QuickRestApi tree so that you can see the “main” folder and there you should see the decoded arrays that we are looking to expose as slots. You need to highlight them, and select “Add” in the top right as shown below:
We want the data as out slots, so we need to reverse the direction from the default “in” to “out” by selecting “Reverse” on the top bar. It should then look like this:
From here you can select “OK” and you now should have the out slots available to link into your station.
If you have any questions about this module, or need help configuring it please reach out to support@innon.co.uk and we would be more than happy to assist you.