Postman is an excellent tool to interact with a REST Web API, such as the iotQi Web API. This guide illustrates the process… Enabling Your Internet of Things.
If you don’t have Postman already installed on your workstation, go the official Postman site at https://www.getpostman.com/ to download your copy. The iotQi works with the free version of Postman just fine.
When you launch Postman you will see it gets started by launching escape pods, distorting time-space continuum, moving satellites into position and other important API prerequisites.
Once started there are only a couple steps to get started with a basic API method call…
- Choose Basic Authentication (this is an HTTPS conversation so your password will not be clearly visible on its way to our servers).
- Enter your credentials…
- All iotQi Web API actions are authenticated. You can use your username (your email address that registered with) and password. Optionally, in Setup you can create a Subscription API Key; this approach is discussed in a section below.
iotQi Web API Structure
All iotQi Web API method calls start with the prefix of https://webapi.loouq.com/api
The above prefix is then followed by the API section. Currently the only available section is /devices/, but that will change as new functionality is added to the API such as setup were you can programmatically modify your subscription and device configurations.
Next comes the action, /commands/, followed by your device name or device Id.
Next followed by your command name (case-sensitive) and any optional command parameters.
Note: Only the command itself is case-sensitive. This is required for cross device compatibility.
Use iotQi Built-In Commands
The iotQi device client found inside all of our device samples has several built-in commands that you can use. None of these commands require parameters and are very simple to test communications with your device.
The getcommandinfo command is implemented at the core of iotQi device logic and used to ensure API commands are valid before even being sent out to the device. Because of this core use, there is another syntax for getting the commands implemented on a device using the bolded phrase below.
Using Commands with Parameters
Using parameters with your command is easy too. Simply add them to the end of your method call with a HTTP query string. So by example, if your command takes two parameters: param1 (a string) and param2 (an integer), you would code that as…
- Parameter names are case sensitive. We recommend all-lower, but if you want to have upper-case letters in your parameter name you can; just be consistent for ease of remembering.
- Postman will handle parameter escaping for you. So use the Postman parameters feature and you don’t have to type that query string at all.