Hey all, I'm hoping to get some guidance on triggering an Azure logic app via HTTPS POST. I am able to trigger the app via other methods (Python, Postman, etc.) but am having trouble translating that onto an Arduino. I've attempted reading through the example sketches but haven't been able to crack it.
Currently the (most common) error returned by my request is a 400 error indicating "The request verb is invalid". To me this would indicate that the POST method I'm using isn't accepted. However, using the POST method works without issue on other platforms. I believe the error is in my formatting of the actual request since my sketch is able to connect to the server.
Here are two simplified versions of the requests which I've tried:
Version 01
String PostData = "testDATA";
Serial.println("\nStarting connection to server...");
// if you get a connection, report back via serial:
if (client.connect(server, 443)) {
Serial.println("connected to server");
// Make a HTTP request:
client.println("POST /workflows/73b6204d5c3POd4956a32425eeb1f7b80e/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=GL6BOAmjPWGNKSi84BP4td1m65UmBi4u9mieQv9NN9UbWU");
client.println("Host: sub-01.eastus.logic.azure.com");
client.println("User-Agent: Arduino/1.0");
client.println("Connection: close");
client.println("Content-Length: ");
client.println(PostData.length());
client.println();
client.println(PostData);
}else {
Serial.println("didn't connect");
Version 02
Serial.println("\nStarting connection to server...");
if you get a connection, report back via serial:
if (client.connect(server, 443)) {
Serial.println("connected to server");
// Make a HTTP request:
client.println("Content-Type: application/json");
client.println("POST /workflows/73b6204d5c3POd4956a32425eeb1f7b80e/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=GL6BOAmjPWGNKSi84BP4td1m65UmBi4u9mieQv9NN9UbWU");
client.println("Connection: close");
client.println();
}else {
Serial.println("didn't connect");
}
Wasn't sure if somebody had attempted to do this before and could point me in the right direction. Any advice is greatly appreciated.
EDIT:
Forgot to include some critical info in my post:
I'm using an Arduino Uno Rev2 and am using the WiFiNINA library to connect to wifi and then using the WiFiSSLClient as my client. I've also loaded a cert onto the board for the domain I'm after using the "Firmware Updater" feature of the Arduino IDE.