Post request from ESP8266 to Xano database
I'm trying to post data into a database table from my IOT device but I keep getting a 308 redirect response. Does anyone have experience with this?
Some of my code:
WiFiClient client;
HTTPClient http;
String serverPath = serverName + "/checklist_devices/";
http.begin(client, serverPath.c_str());
int httpResponseCode = http.GET();
Response:
Best Answer
-
Yeah I got it working.
I'm working in C++ using PlatformIO. I used the ESP8266 WifiClientSecure library (previously I was trying regular WifiClient). The trick was the line client.setInsecure(). I'll have to go back and figure ssl certificates eventually but for now this works great.FYI, the variables "host" and "data" are type "String"
Thanks for your help and quick responses Chris!
Answers
-
My first thought is that there is an issue with the request URL. Are you able to provide the full URL? If you don't want to share it here, feel free to reach out to us via support chat!
-
Seems to be an issue with sending requests via HTTP. I guess it needs secure requests via HTTPS
-
Yes, that is correct — all requests need to be sent via HTTPS. Are you able to accommodate this with the IOT device in question? If not, there is probably a world where you could proxy requests through a server you control which would allow for making unsecured requests.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback