Using the Windows curl command to send data to JEDI One

Using the curl command from a Windows command prompt is a useful way to send data to JEDI One.  The syntax is slightly different when using it from the Windows command prompt than it is in Linux.  Double quotes " must be used instead of single quotes and any double quotes that are part of the data (-d) will need to be escaped with the backslash character \.

Here is a working example:

C:\Users\joe>curl -X POST  "http://localhost:8100/v1/data/mc" -H "Content-Type: application/json" -d "{\"context\": {\"target_id\": \"SensorHTTPTest\",\"target_ip\": \"192.168.2.1\",\"timestamp\": \"2020-06-15T17:32:59+0530\"},\"data\": {\"online\": true}}"

And the reply:

"Data sent successfully"

 

For Windows Powershell call out curl.exe explicitly and change to single quotes around argument data:

PS C:\Users\dario> curl.exe -X POST  'http://localhost:8100/v1/data/mc' -H 'Content-Type: application/json' -d '{\"context\": {\"target_id\": \"SensorHTTPTest\",\"target_ip\": \"192.168.2.1\",\"timestamp\": \"2020-06-15T17:32:59+0530\"},\"data\": {\"online\": true}}'

And the reply:
 
"Data sent successfully"

 

 

Was this article helpful?
0 out of 0 found this helpful