I am using WSO2 IOT server, RaspberryPi 3 device with LED and DTH11 sensor. I can manage LED with console.
What I am trying to do is turn it On and Off with my mobile application. So, I want to know how can I send the HTTP request to the API and the request also. The server is running in localhost. Can anyone help me?
This is the command I used:
curl -k -X POST https://172.16.13.86:8243/api/device-mgt/v1.0/devices/raspberrypi/operations
-H 'accept: application/json' -H 'authorization: Bearer a7a156d7-0393-3350-8b9b-0ac956723440'
-H 'content-type: application/json' -d '{"deviceIdentifiers":[r1lovwmwg113],
"operation":{"code":"bulb","type":"CONFIG", "payLoad":"state:ON"}}'```
And this is the reply:
{"activityId":"ACTIVITY_36492","code":"bulb","type":"CONFIG","createdTimeStamp":"Fri
Dec 21 11:38:20 IST
2018","activityStatus":[{"deviceIdentifier":{"id":"r1lovwmwg113","type":"raspberrypi"},"status":"PENDING"}]}
Related
They seem to have documentation and a video for making Burp Suite Enterprise as a web server but it's different than my Burp Suite Pro dashboard/options and I can't find a way to do this.
The main reason why I need this is because I would like to make API calls using this example format from their site
curl --request POST \
--url [your-burp-enterprise-server-url]:[port]/graphql/v1 \
--header 'Authorization: [api-key]' \
--header 'Content-Type: application/json' \
--data '{"query":"query GetSiteTree {\nsite_tree {\nsites {\nid\nname\nscope {\nincluded_urls\nexcluded_urls\n}\napplication_logins {\nlogin_credentials {\nlabel\nusername\n}\nrecorded_logins {\nlabel\n}\n}\nparent_id\nextensions {\nid\n}\n}\nfolders {\nid\nname\n}\n}\n}","operationName":"GetSiteTree"}'
The very first part requires my Burp Suite URL, which requires me to set up Burp Suite as web server, but I'm using Professional and they only have documentation for doing it with Enterprise Edition.
I tried to create AWS Device farm remote session, which i am able to do it successfully. The response JSON of the created remote session has an endpoint (wss) and the hostAddress(IP). Rather then login into AWS device farm to interact with the device. I wanted to provide remote access directly on my own web page (I am not sure whether its possible). Hoping it can be rendered under a canvas tag.
Though i do not have experience on the socket, i just tried some sample code to connect with the received Web Socket URL.
var wsUri = "wss://devicefarm-interactive.us-west-2.amazonaws.com/?X-Amz-Date=*&X-Amz-Credential=*&X-Amz-Algorithm=*&X-Amz-SignedHeaders=host&X-Amz-Signature=*&X-Amz-Security-Token=*";
var websocket = new WebSocket(wsUri);
websocket.send('ping');
Below is the error the console.
Connection closed before receiving a handshake response.
Any sample links to implement would be helpful
I'm able to reproduce that error. I looked for examples of using the web socket connection using the networking tab after inspecting the page in chrome(since it has a web socket debugger built into it) which will show the following:
Basically how that appears to be working is it's sending us a constant stream of images.
When I copy as cURL command this is the result
curl 'wss://devicefarm-interactive.us-west-2.amazonaws.com/?X-Amz-Date=20190518T211708Z&X-Amz-Credential=ASIAIGY76PSQXN5NZ3UA%2F20190518%2Fus-west-2%2Fdevicefarm%2Faws4_request&X-Amz-Algorithm=AWS4-HMAC-SHA256&arn=arn%3Aaws%3Adevicefarm%3Aus-west-2%111122223333%3Asession%3A8f4af46d-8f86-4dcc-8324-e691ce3723f3%2F6b4dc632-188f-45b9-be32-3e9aa6881ed3%2F00000&X-Amz-SignedHeaders=host&X-Amz-Signature=39b45e1489d44dfcb904d58e59e985844416061a828aa75750d5a67db36c55dd&X-Amz-Security-Token=someTokenValue&path=video' -H 'Pragma: no-cache' -H 'Origin: https://us-west-2.console.aws.amazon.com' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: en-US,en;q=0.9' -H 'Sec-WebSocket-Key: 60RGfCwWuULib6NmeoC2fA==' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36' -H 'Upgrade: websocket' -H 'Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits' -H 'Cache-Control: no-cache' -H 'Connection: Upgrade' -H 'Sec-WebSocket-Version: 13' --compressed
When I did the following CLI command I get the endpoint back:
aws devicefarm get-remote-access-session --arn arn:aws:devicefarm:us-west-2:111122223333:session:8f4af46d-8f86-4dcc-8324-e691ce3723f3/6b4dc632-188f-45b9-be32-3e9aa6881ed3/00000 --region us-west-2 --query remoteAccessSession.endpoint
"wss://devicefarm-interactive.us-west-2.amazonaws.com/?X-Amz-Date=20190518T212323Z&X-Amz-Credential=ASIAIU5CA7GBP5IEBR6Q%2F20190518%2Fus-west-2%2Fdevicefarm%2Faws4_request&X-Amz-Algorithm=AWS4-HMAC-SHA256&arn=arn%3Aaws%3Adevicefarm%3Aus-west-2%3A111122223333%3Asession%3A8f4af46d-8f86-4dcc-8324-e691ce3723f3%2F6b4dc632-188f-45b9-be32-3e9aa6881ed3%2F00000&X-Amz-SignedHeaders=host&X-Amz-Signature=aaaaqaqbbbb4e9f09b7312715c295a11b77bc0d9e7b21dcb61422a61f78a1f&X-Amz-Security-Token=FQoGZXIvYXdzEFcaDD2E90%2Bsp3i%2F%2F8cBbyKDA2EGKkFYSvXDR%2Fb7LfS%2FpQEPCWFVhe9eCOTSussvshjldx69CEFvVgV3JYtOvm2yu0UMVAxlDYlujvpMfSNwLx7FH%2B42k9qGYuvy5dQbVLg%2F%2BCRuyK9OjCxpD5pUfQ9b81U6LawcI2I1CekXeTgapRuTK9tCPcGtNOlxAvWQUVlyDGTtmqjz7vRlostquMoenNr9UB1v8jx0NSo1YIlrgY8YvZV2o5pcbYiI9I9CBD0%2F3snJZAyQtmPZkMT9gr9hI0jgX1X5MlOuarFmm%2F2Sn%2FH8L3ewMQXhvuho3OTNZTISBmUgJAbZSmQcazuDmjXqPkoNpYYcUb92vd2w5MbRfFSa5SHHXUMVcE5Wsop3BzwJyj%2FNyl59BdjFWdo82NgSFP6OBjYLjiux3hR2dx86ILJ9tfNMNfq0WXzL3Z%2BqecwMTxlxrLfZmPftsUDaO5RPtOP9uuI%2BPjfIOWOV7uFy9GjKG4HKFY%2BZVGgWhb1fVVG7%2BYHbPxgMaAKI3YJqmM9IIy8%2FdCjL74HnBQ%3D%3D%7CMjA1LjI1MS4yMzMuMTc5"
which appears to be signed. Using wscat I tried to connect to it.
endpoint=$(aws devicefarm get-remote-access-session --arn arn:aws:devicefarm:us-west-2:111122223333:session:8f4af46d-8f86-4dcc-8324-e691ce3723f3/6b4dc632-188f-45b9-be32-3e9aa6881ed3/00000 --region us-west-2 --query remoteAccessSession.endpoint)
wscat -c $endpoint
Error:
/usr/local/lib/node_modules/wscat/node_modules/ws/lib/websocket.js:455
throw new Error(Invalid URL: ${this.url});
I'll need to spend some more time on this later but I think some of this content is helpful so I posted it.
I am using WSO2 IOT server with raspberrypi 3. I am in the beginning level. I was able to switch on/off the LED bulb which is connected to raspberrypi with this command.
curl -k -X POST "https://172.16.13.86:8243/raspberrypi/1.0.0/device/us310v497by0/bulb?state=on" -H "accept: application/json" -H "Authorization: Bearer 739e2223-62b6-3a24-890f-5b6e610ed6d2"
Now I want to get the current temperature which is detected by the dht11 sensor. I want to know a same type of command which I used for switch on/off the LED bulb. Can anyone help me please?
Please try:
curl -X GET --header 'Accept: application/json' 'https://ServerIP:9443/api/device-mgt/v1.0/events/last-known/deviceType/deviceId' -H "Authorization: Bearer token"
I have web service running on server URL-http://localhost:8080/getdata
I want to call the web service through curl which take an parameter {"time":"2016-3-30 13:47:13"}
can any one help me with syntax
curl -i -X POST -H "Content-Type: application/json" -d "{\"time\":\"2016-3-30 13:47:13\"}" http://localhost:8080/getdata
Do you guys know how I can use the Curl command line to POST SOAP to test a web service?
I have a file (soap.xml) which has all the soap message attached to it I just don't seem to be able to properly post it.
Thanks!
Posting a string:
curl -d "String to post" "http://www.example.com/target"
Posting the contents of a file:
curl -d #soap.xml "http://www.example.com/target"
For a SOAP 1.2 Webservice, I normally use
curl --header "content-type: application/soap+xml" --data #filetopost.xml http://domain/path
Wrong.
That doesn't work for me.
For me this one works:
curl
-H 'SOAPACTION: "urn:samsung.com:service:MainTVAgent2:1#CheckPIN"'
-X POST
-H 'Content-type: text/xml'
-d #/tmp/pinrequest.xml
192.168.1.5:52235/MainTVServer2/control/MainTVAgent2
curl -H "Content-Type: text/xml; charset=utf-8" \
-H "SOAPAction:" \
-d #soap.txt -X POST http://someurl
If you want a fluffier interface than the terminal, http://hurl.it/ is awesome.