This tool is designed to import things from one or more files in a specific directory into a Bosch IoT Things service instance. The file(s) should contain one thing per line in JSON format e.g.
{ "thingId": "namespace:thing-name", "policyId": "namespace:policy-name", "attributes": { "foo": 1 }, "features": {...} }
- Knowledge of Java
- Knowledge of Maven
- Solution information like solutionId and apiToken have to be present.
- Namespace in which the things should be imported, have to be created.
- Import file(s) with one thing per line in JSON format.
- User of Bosch IoT Permissions or - alternatively - Public Key for authenticating the Things client.
- Websocket endpoint has to be configured in config.properties.
Create at least one policy which you can assigned to your things.
Set your credentials under /src/main/resources/config.properties
. You can use src/main/resources/config-template.properties
as a template.
Build the jar file with following command.
mvn clean install
cd target
java -Xms2G -Xmx4G -DthingsConfigFile="### absolutePathToConfig ###" -jar things-batch-importer-0-SNAPSHOT-jar-with-dependencies.jar "### absolutePathToUploadDirectory ###"
If the import is interrupted the import tool can just be re-executed. It then continues to import where it previously stopped.
The import tool will create the following files during the batch import:
- completedFile.txt - contains all files which were uploaded successfully.
- errorFile - contains the error messages for the things which could not be uploaded.
- retryFile.txt - contains the things and the error message why it could not be uploaded, separated by a '#'.
See the iot-things-examples top level README.md file for license details.