This article explains how to use Postman to create multiple devices in a ground at once.
One of the common maker challenges is to automate your home. For example, monitor loudness level in your house. You’ve assembled 8 devices, and each device measures loudness of each room in your house.
Now you want to connect the devices to AllThingsTalk Maker, so you can develop neat monitoring solution for you and your family.
Instead of manually creating a device resource in Maker for each of your devices, you want to automate the process and save some precious time.
To follow the article you’ll need:
Here are the steps you will do:
Create a CSV file to specify each device name and title. It should look like this:
It’s important that you use
deviceTitle as column names, because Postman will use those variable names.
Once in Maker, choose a ground where you will create your devices. From the left-hand side navigation select
Copy GROUND ID and GROUND TOKEN. You’ll use those credentials to authenticate Postman client and create your devices in the ground.
If there is no Ground token generated for the ground, click
GENERATE NEW TOKEN.
Run Postman and add API request to create a ground device using AllThingsTalk open API.
+ New Collection
Add requests and name it, e.g.
Create ground devices
POST as the request method
api.allthingstalk.io/ground/NYzFLolKLvHNA6D28CG0CJ6c/devices as the URL endpoint
Under Body tab, specify device specs, e.g.:
"description": "A device for monitoring home loudness.",
deviceName variable will use values from
deviceName column from your CSV file
deviceTitle variable will use values from
deviceTitle column from your CSV file
tests["It returns 201"] = responseCode.code === 201;
In Postman, in the top left corner select
Runner. It fires a request (or the whole collection) through a number of specified iterations.
Create ground devices request
Preview; it should look like this:
Run to run the batch
deviceTitle from the CSV for each row, and fire 8 requests towards AllThingsTalk API
In Maker, you should see 8 new devices in your ground:
Now you can learn how to implement those new devices and start getting your data in Maker.