How do I get the HTTP response from an arduino post?

Marcio Valenzuela on 4 Oct 2021
Latest activity Reply by Christopher Stapels on 7 Oct 2021

How do I code my arduino sketch in order to get the HTTP response from an arduino post?

Christopher Stapels
Christopher Stapels on 4 Oct 2021

We usually recommend the ThingSpeak library, you can use the readRaw function

String readRaw (channelNumber, URLSuffix, readAPIKey)	 

The soil moisture example shows how to get the response specifically without the library. Sadly, the plant finally died after I collected about 4 years of soil moisture data from it.

Marcio Valenzuela
Marcio Valenzuela on 4 Oct 2021

ok I looked over the posting a single data field example. So the thing is im not using the WiFi library because im using a roving networks tinysine wifibee v1r1 uno shield from roving networks. I use a library called the wiflyHQ so Im using this to try to post directly:

int x = ThingSpeak.writeField(847481, 3, 6, "mykey");
    if(x == 200){
      Serial.println("Channel update successful.");
    }
  else{
    Serial.println("Problem updating channel. HTTP error code " + String(x));
  }
but it fails to post and i dont get the successful or the http error message.
Christopher Stapels
Christopher Stapels on 7 Oct 2021

If you are using the ThingSpeak library, readRaw function should work for you.