-->
Page 1 of 1

HTTPS post to Microsoft Flow

PostPosted: Tue Feb 05, 2019 7:08 am
by nick9one1
I'm trying to make a HTTPS post to microsoft flow.

I can post to Flow using apitester.com like so;
Image

I've tried to replicate this with the ESP8266 but having problems.

I found the following example - https://github.com/esp8266/Arduino/issues/2834

Here i my code
Code: Select all#include <ESP8266WiFi.h>          //https://github.com/esp8266/Arduino
#include <ArduinoHttpClient.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>         //https://github.com/tzapu/WiFiManager
#include <ESP8266HTTPClient.h>

void setup() {

    Serial.begin(115200);
   
    Serial.println("Attempting to connect to wifi");
   
    WiFiManager wifiManager;
   
    //wifiManager.resetSettings(); //reset saved settings
   
    wifiManager.autoConnect("AutoConnectAP");
   
    Serial.println("connected");
}

void loop() {
 
  Serial.println("attempt POST");
  HTTPClient http;
  http.begin("https://prod-23.westeurope.logic.azure.com:443/workflows/4221219928b1479186337912abba9907/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=FxDTZGTHI1iF784ILXLXM707U0TonG_j_xxxxxxxxxxx");
  http.addHeader("Content-Type", "application/json");
  String postMessage = "{'temp':'21'}";
  int httpCode = http.POST(postMessage);
  Serial.print("http result:");
  Serial.println(httpCode);
  http.writeToStream(&Serial);
  String payload = http.getString();
  http.end();


 
  delay(5000);  //Post Data at every 5 seconds
   
}


my only output is;

Code: Select allAttempting to connect to wifi
*WM:
*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 3
*WM: IP Address:
*WM: 192.168.43.166
connected
*WM: freeing allocated params!
attempt POST
http result:-1

Re: HTTPS post to Microsoft Flow

PostPosted: Thu Feb 07, 2019 2:39 pm
by nick9one1
not sure why this post took so long to be approved, but I got it working already :)