- This topic has 9 replies, 2 voices, and was last updated 5 years, 3 months ago by Julius Ski.
-
AuthorPosts
-
July 4, 2019 at 2:54 pm #6654Julius SkiParticipant
Hello guys, I am currently working on some open source project on metering radiation with ESP8266 (will be posted in git later), would like to include data post to uRAD database, but could not find any API how to perform HTTP POST queries. Tried such scenario:
perform POST to data.uradmonitor.com with such contents:POST /api/v1/upload/exp/ HTTP/1.1 Host: data.uradmonitor.com X-User-id: 4085 X-User-hash: <hash_here> X-Device-id: 0 User-Agent: uRADMonitor/1.1 Accept: */* Host: data.uradmonitor.com Content-Length: 44 01/120/0E/106/0F/123/0B/15/0C/399/0D/54/10/1
got response with new deviceID: 13000206 which was stored in flash, and further queries looks like this:
POST /api/v1/upload/exp/ HTTP/1.1 Host: data.uradmonitor.com X-User-id: 4085 X-User-hash: <hash_here> X-Device-id: 13000206 User-Agent: uRADMonitor/1.1 Accept: */* Host: data.uradmonitor.com Content-Length: 44 01/180/0E/106/0F/123/0B/15/0C/399/0D/54/10/1
,however no data is being parsed by the server: https://www.uradmonitor.com/tools/dashboard-04/?open=13000206
What am I doing wrong ? If project owner does not respont, could someone with working KIT1 capture the data with headers sent to server and share it here ?
Thanks.
July 7, 2019 at 9:09 am #6661uRADMonitorKeymasterhi Julius! Would love to see your ESP design. Post some pics! I wanted to do something similar but I didn’t have the chance yet. However the SMOGGIE is using it:
Looking over your ID, I see some data has been pushed:
https://www.uradmonitor.com/tools/dashboard-04/?open=13000206So I assume you were successful. The 0E (hardware ID) and OF (software ID) seem not to be received.
What response are you getting on your calls?
July 7, 2019 at 12:54 pm #6663Julius SkiParticipantI do get json:
{
“success” : “ok”
}Seems like the server ignores/incorrectly accepts the body part of the POST, maybe because of headers, not sure how to debug it.
Photo (dev version) 🙂 https://gyazo.com/5c74f419f27f7c08d0b5894c3366822f
July 7, 2019 at 2:04 pm #6664Julius SkiParticipantI did even reconstruct the order of headers to match the KIT1 source, in intense if your server is reading headers incrementally:
POST /api/v1/upload/exp/ HTTP/1.1 Host: data.uradmonitor.com User-Agent: uRADMonitor/1.1 X-User-id: 4085 X-User-hash: <hash_here> X-Device-id: 13000206 Accept: */* Content-Length: 39 Content-Type: application/x-www-form-urlencoded 01/6/0E/106/0F/123/0B/0/0C/0/0D/54/10/1 200 {"success":"ok"} POST /api/v1/upload/exp/ HTTP/1.1 Host: data.uradmonitor.com User-Agent: uRADMonitor/1.1 X-User-id: 4085 X-User-hash: <hash_here> X-Device-id: 13000206 Accept: */* Content-Length: 43 Content-Type: application/x-www-form-urlencoded 01/60/0E/106/0F/123/0B/24/0C/399/0D/54/10/1 200 {"success":"ok"} POST /api/v1/upload/exp/ HTTP/1.1 Host: data.uradmonitor.com User-Agent: uRADMonitor/1.1 X-User-id: 4085 X-User-hash: <hash_here> X-Device-id: 13000206 Accept: */* Content-Length: 44 Content-Type: application/x-www-form-urlencoded 01/120/0E/106/0F/123/0B/31/0C/400/0D/54/10/1 200 {"success":"ok"} POST /api/v1/upload/exp/ HTTP/1.1 Host: data.uradmonitor.com User-Agent: uRADMonitor/1.1 X-User-id: 4085 X-User-hash: <hash_here> X-Device-id: 13000206 Accept: */* Content-Length: 44 Content-Type: application/x-www-form-urlencoded 01/180/0E/106/0F/123/0B/24/0C/400/0D/54/10/1 200 {"success":"ok"} POST /api/v1/upload/exp/ HTTP/1.1 Host: data.uradmonitor.com User-Agent: uRADMonitor/1.1 X-User-id: 4085 X-User-hash: <hash_here> X-Device-id: 13000206 Accept: */* Content-Length: 44 Content-Type: application/x-www-form-urlencoded 01/241/0E/106/0F/123/0B/19/0C/400/0D/54/10/1 200 {"success":"ok"}
Still, no data passed. I would debug it myself, if I would have ENC eth adapter, just need to print to UART message before sending.
July 7, 2019 at 6:32 pm #6666uRADMonitorKeymasterPlease leave it running, I’m checking it on the server side.
July 8, 2019 at 12:25 pm #6667uRADMonitorKeymasterhi Julius,
The problem is minor:
You need to pass the data part as part of the script url, and have 0 bytes content, like this:
1562587805> 1562587805, 79.208.244.110, upload/exp/01/141780/0E/105/0F/122/0B/23/0C/384/0D/595/02/31.00/03/100451/04/25, Host: data.uradmonitor.com User-Agent: uRADMonitor/1.1 X-User-id: 452 X-User-hash: *** X-Device-id: 130001FF Accept: */* Content-Length: 0 Content-Type: application/x-www-form-urlencoded
Instead you are sending the “EXP data” part , as the HTTP Post body, and the body has non 0 length:
1562587644> 1562587644, 78.56.46.177, upload/exp/, 01/4349/0E/106/0F/123/0B/32/0C/399/0D/54/10/1 Host: data.uradmonitor.com User-Agent: uRADMonitor/1.1 X-User-id: 4085 X-User-hash: *** X-Device-id: 13000206 Accept: */* Content-Length: 45 Content-Type: application/x-www-form-urlencoded
Would you post a few pics with your setup? Ideally a blog post on this would be awesome, on how you made your ESP variant and the software for it. I can update your account for blog access, let me know if you are willing to do it.
July 8, 2019 at 1:58 pm #6668Julius SkiParticipantWow, that’s my bad, traced it badly in the KIT1 source 🙁 didn’t even foreknow that empty body can be sent…
It’s working now fine, thank you for assistance.
Setup is not finished yet, but it includes 2x 16bit adc’s for HV and Battery measurements, PID regulated HV voltage, local HTTP server for management. I will now include BME sensor as well. Perhaps I could tell more about the project later when the beta is finished, I will post to GitHub, then I will contact you.
Thanks again!
July 8, 2019 at 2:35 pm #6669uRADMonitorKeymasterExcellent
July 10, 2019 at 1:50 am #6670Julius SkiParticipantSome updates on GUI while I am waiting for my BME280 sensor, temporarily BMP180 was added (no humidity).
Also, I have some issues on battery voltage uploads, I tried to post it as 0A/4.20 and 0A/4.20V, but it always shows in a detailed page (https://www.uradmonitor.com/tools/dashboard-04/?open=13000206) as 4.20undefined. How to add measuring units?
July 10, 2019 at 2:29 am #6671Julius SkiParticipantSome video in-action: https://youtu.be/oBJsqtiIqns
-
AuthorPosts
- You must be logged in to reply to this topic.