0 Replies Latest reply on Jul 1, 2017 10:38 PM by ajunaid RSS
    ajunaid Newbie

    ESP8266HTTPclient PUT call

    Hello Ben and team,

    Great course !!

    We are trying to update a value on the TWX server on a specific property ...

    we are using  #include <ESP8266HTTPClient.h>

    for some reason the http.PUT method is not invoking correctly ..

    with out the client we are trying the below with no luck.

    const int httpPort = 80;
    if (client.connect(server, httpPort)) {
    Serial.println("connected");
    String fullRequestURL = String(server) + "/Thingworx/Things/" + ThingName + "/Properties/" + Property + +"?appKey=" + String(APIKEY);
    client.println("PUT /posts HTTP/1.1");
    client.println(fullRequestURL);
    client.println("Cache-Control: no-cache");
    client.println("Content-Type: application/json");
    client.print("Content-Length: ");
    String PostData = "{\"TEMP\":\"23\"}" ;
    //int len = dataptr.length();
    client.println(PostData.length());
    client.println();
    client.println(PostData);

    any input would be appreciated .

    Thanks in advance