Replies: 4 comments 1 reply
-
I don't know what postman is, but you can use the -v option in curl to see the
exact headers being sent, then compare that to what postman sends. Also, drop
the -X POST.
|
Beta Was this translation helpful? Give feedback.
-
If you want to send the JSON you show below, then why does the command line send something completely different? Also, you may want to use |
Beta Was this translation helpful? Give feedback.
-
it doesn't works: **_curl -vv --json '{"deviceid":"1001e98eb4","data":{}}' -H Content-Type:application/json http://192.168.1.87:8081/zeroconf/info
< HTTP/1.1 200 OK |
Beta Was this translation helpful? Give feedback.
-
You now have the headers sent by curl for this request. Do the same with postman and compare. Also, you don't need to set Content-Type: when you use --json. |
Beta Was this translation helpful? Give feedback.
-
Hello.
I bougth a Sonoff MINI R2 and want to pilote it trougth DIY request.
I succed to do it with postman, but i want to ceate a link on my office so i tried to send request with cURL.
the cURL request is:
curl -d '{"deviceid":"","data":{}}' -H Content-Type:application/json -X POST http://192.168.1.87:8081/zeroconf/info
then i receive an error:
{"seq":10,"error":400}
when i import this command in postman, it works well and i reveive:
{
"seq": 10,
"error": 0,
"data": {
"switch": "off",
"startup": "off",
"pulse": "off",
"pulseWidth": 500,
"ssid": "box JML",
"otaUnlock": false,
"fwVersion": "3.7.3",
"deviceid": "1001e974d4",
"bssid": "60:35:c0:b3:33:b5",
"signalStrength": -76
}
}
What is the problem ? why it doesn't works with cURL ?
and what must i do to make it works ?
Beta Was this translation helpful? Give feedback.
All reactions