I'm new to Arduino programming so this might be a stupid question. I'm trying to post the readings of a temperature sensor from my Arduino MKR1000 to my REST API. This sometimes works, however the Arduino is not always posting to the same URL. It seems random when it posts to the defined URL, and when to just /.
17:54:22.384 -> Connected to SSID: MY_SSID
17:54:23.148 -> Temperature: 25.06
17:54:23.148 -> POST data: name=Arduino&temperature=25.06
17:54:23.148 -> Making POST request
17:54:23.148 -> /api/log_entries
17:54:25.367 -> Request finished
17:54:39.393 -> Status code: 405
17:54:41.341 -> Response: {
............ -> ...
17:54:41.376 -> }
17:54:41.376 -> Wait five seconds
17:54:47.106 -> Temperature: 25.06
17:54:47.106 -> POST data: name=Arduino&temperature=25.06
17:54:47.106 -> Making POST request
17:54:47.106 -> /api/log_entries
17:54:47.329 -> Request finished
17:55:01.308 -> Status code: 201
17:55:02.309 -> Response: {"name":"Arduino","temperature":25.06,"updated_at":"2020-06-01T15:54:47.000000Z","created_at":"2020-06-01T15:54:47.000000Z","id":79}
17:55:02.309 -> Wait five seconds
17:55:08.028 -> Temperature: 25.06
17:55:08.028 -> POST data: name=Arduino&temperature=25.06
17:55:08.028 -> Making POST request
17:55:08.028 -> /api/log_entries
17:55:08.302 -> Request finished
17:55:23.318 -> Status code: 405
17:55:25.267 -> Response: {
............ -> ...
17:55:25.305 -> }
17:55:25.305 -> Wait five seconds
The status codes 405 are because the library is posting to / instead of /api/log_entries. If I let it run for a while, I think 60% of the requests are to the correct endpoint and successful, while the rest POSTs to / and fails.
Hi,
I'm new to Arduino programming so this might be a stupid question. I'm trying to post the readings of a temperature sensor from my Arduino MKR1000 to my REST API. This sometimes works, however the Arduino is not always posting to the same URL. It seems random when it posts to the defined URL, and when to just /.
Code:
Example serial output:
The status codes 405 are because the library is posting to
/
instead of/api/log_entries
. If I let it run for a while, I think 60% of the requests are to the correct endpoint and successful, while the rest POSTs to/
and fails.Any ideas?