The SAP IoT Connect 365 API documentation describes how to create one endpoint. By using Postman we will explain how to create x number of endpoints at once. Let's first take a look at the information we need to gather about an endpoint in order to create one (point 1). We'll then send two APIs requests to create multiple endpoints (point 2) at once and we will finally create them (point 3).
1. Necessary information to create an endpoint
According to the API documentation, the POST API used to create one endpoint on the SAP IoT Connect 365 platform, needs to have the following information:
Name of the endpoint (required);
Tags (optional) - You have the possibility to add specific information for each endpoint.
Status: activate or not (required) - is the endpoint activated or disable.
Service profile (required) - ID of the Service Profile assigned to the endpoint. To find this information, navigate to the "Service Profiles" tab in the UI or run this API.
Tariff profile (required) - ID of the tariff Profile assigned to the endpoint. To find this information, navigate to the "Tariff Profiles" tab in the UI or run this API.
SIM (optional) - if we want to directly assign a SIM to the created endpoint, we need to enter here the SIM ID. To find this information, navigate to the SIMs tab in the UI.
For each endpoint we want to create, the information detailed above must be entered. In order to create several of them at once, we can use the "Runner" option in Postman. To do so, create a .csv file (separated with comma) and enter the information as follow:
The numbers of rows you have should be equal to the number of endpoints you wish to create i.e. you need one row for each endpoint.
2. Preparing the APIs to run
To run any API on our platform, you need to authenticate (point 2.1) and then run the endpoint creation API (point 2.2)
We are now ready to run the APIs multiple times and create several endpoints at once. In Postman, click Runner, select a collection, an environment, and your '.csv' file. The number of iterations should then automatically be detected. You can preview your file to be sure that everything is fine before clicking start run. This is how the preview should look like:
3.1 Responses if everything went fine
Authentication post API: 200 OK Create endpoint post API: 201 Created
3.2 Responses when you have an issue
If your authentication API failed, nothing will work.
If the endpoint creation API failed, check the following:
Is your .csv file comma delimited (excel can be a bit messy sometimes, you can try another program like notepad++);
Check the spelling of your variables: they should be written exactly the same way in the .csv file and in Postman;
Check the format of the API body where it is easy to forget a character.