If you are a roadtester, and are having a problem, please ask your question in this forum. Our members monitor our forums. Thus, it's the first place to get some assistance.
If you are a roadtester, and are having a problem, please ask your question in this forum. Our members monitor our forums. Thus, it's the first place to get some assistance.
I've been working with the Microchip mini dev board in the Arduino environment [Side note, very nice board so far]. I am converting a program that currently runs using Wifi to this board. It does a POST to a service called Scriptr. The original stripped down code that does the POST is:
// Working code for Wifi (stripped of error checking and other extraneous stuff) const char* ssid = "myssid"; const char* password = "mypw"; String mymsg = "TestMSG"; const char* bearer = "xxxxx...xxxxx"; // API Key WiFiSSLClient client; WiFi.begin(ssid, password); client.connect("api.scriptrapps.io", 443)) client.print(String("POST ") + "/SNDSMS/?sms=" + mymsg + " HTTP/1.1\r\n" + "Host: api.scriptrapps.io\r\n" + "Authorization:bearer " + bearer + "\r\n" + // 23 + 68 "Content-type: application/x-www-form-urlencoded\r\n" + "Connection: close\r\n\r\n");
The corresponding code for the Microchip mini dev board that I've tried is:
Lte.begin(); HttpClient.configure(host, 443, true); // Have tried true and false for TLS HttpResponse response; // Following doesn't work response = HttpClient.post("/SNDSMS/","?sms=TestMSG HTTP/1.1\r\nHost: api.scriptrapps.io\r\nAuthorization:bearer xxxxx...xxxxx\r\nContent-type: application/x-www-form-urlencoded\r\nConnection: close\r\n\r\n" ); // Following doesn't work either response = HttpClient.post("/SNDSMS","/?sms=TestMSG HTTP/1.1\r\nHost: api.scriptrapps.io\r\nAuthorization:bearer xxxxx...xxxxx\r\nContent-type: application/x-www-form-urlencoded\r\nConnection: close\r\n\r\n" ); // Following doesn't work either response = HttpClient.post("api.scriptrapps.io","/SNDSMS/?sms=TestMSG HTTP/1.1\r\nHost: api.scriptrapps.io\r\nAuthorization:bearer xxxxx...xxxxx\r\nContent-type: application/x-www-form-urlencoded\r\nConnection: close\r\n\r\n" );
I ran https_configure_ca so HTTPS should be enabled.
I"ve tried numerous guesses at how to format the Post request for the board, all either result in a response of 400 or 0.
The board is connecting just fine to AT&T and obviously sending the request to Scriptr or I wouldn't be getting 400 errors (at least some of the time).
Can anyone point me to how I should be formatting the POST request so that it does what the Wifi version does?
Thank you, Ira.
Responded here: /products/roadtest/f/forum/51837/microchip-avr-iot-question-how-to-correctly-format-a-post-request
(Side note: in general, for any issue like this, it comes in handy to have a way to prototype sending/receiving the HTTP POST messages, so the information there applies to any microcontroller). It would be nice if the user docs had more examples though, since what you're asking for is not an unsurprising question that most users would want to know. Once you know the answer, do please post it to help others using that board.