I have to insert many data in my application and through the graphical interface it takes many time. For this reason I want to create a bash script and make the requests through curl using the REST API (I have to manually specify the id).
The problem is that i get the error: The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.
Here is the code
#!/bin/bash for i in {1..1} do CURL='/usr/bin/curl -X POST' RVMHTTP="http://192.168.1.101:8080/sitewhere/api/devices -H 'accept:application/json' -H 'content-type:application/json' -H 'x-sitewhere-tenant:sitewhere1234567890' --user admin:password" DATA=" -d '{\"hardwareId":\"$i",\"siteToken\":\"4e6913db-c8d3-4e45-9436-f0a99b502d3c\",\"specificationToken\":\"82043707-9e3d-441f-bdcc-33cf0f4f7260\"}'" # or you can redirect it into a file: $CURL $RVMHTTP $DATA >> /home/bluedragon/Desktop/tokens done The format of my request has to be json