cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Unable to authenticate thingworx by using arduino uno ide.

ahmed123
4-Participant

Unable to authenticate thingworx by using arduino uno ide.

#include <DHT_U.h>
#include <SPI.h>
#include <Ethernet.h>
#define propertyCount 2
#define DHTPIN 2 // what digital pin we're connected to
#define DHTTYPE DHT11

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};

char server[] = "https://academic.cloud.thingworx.com/Thingworx/Things/salesforceThing_ahmed123/Properties/Temperature";

EthernetClient client;

char appKey[] = "03bbedef-bb57-4ec1-9cad-8126d72d2e75";

char thingName[] = "salesforceThing_ahmed123";

int timeBetweenRefresh = 5000;

char serviceName[] = "setTempAndHumid";


char* propertyNames[] = {"Temp", "Humid"};

double propertyValues[propertyCount];

unsigned long lastConnectionTime = 0;

boolean lastConnected = false;

DHT dht(DHTPIN, DHTTYPE);

 

##########################################################################

 

I'm getting this response in arduino uno serial monitor,

could you please guide me with proper instruction where I'm I getting wrong.

 

DHT22 Library Demo
Trying to get an IP address using DHCP
My IP address: 192.168.0.38
Humidity: 27.00 % Temperature: 30.00 *C 86.00 *F Heat index: 28.55 *C 83.40 *F
Humidity: 27.00 % Temperature: 30.00 *C 86.00 *F Heat index: 28.55 *C 83.40 *F
connected
POST /Thingworx/Things/salesforceThing_ahmed123/Services/setTempAndHumid?appKey=03bbedef-bb57-4ec1-9cad-8126d72d2e75&method=post&x-thingworx-session=true<&Temp=30.00&Humid=27.00> HTTP/1.1
Host: https://academic.cloud.thingworx.com/Thingworx/Things/salesforceThing_ahmed123/Properties/Temperature
Content-Type: text/html

Humidity: 28.00 % Temperature: 30.00 *C 86.00 *F Heat index: 28.62 *C 83.51 *F
Humidity: 27.00 % Temperature: 30.00 *C 86.00 *F Heat index: 28.55 *C 83.40 *F
connected
POST /Thingworx/Things/salesforceThing_ahmed123/Services/setTempAndHumid?appKey=03bbedef-bb57-4ec1-9cad-8126d72d2e75&method=post&x-thingworx-session=true<&Temp=30.00&Humid=28.00> HTTP/1.1
Host: https://academic.cloud.thingworx.com/Thingworx/Things/salesforceThing_ahmed123/Properties/Temperature
Content-Type: text/html

 

2 REPLIES 2
AdamR
12-Amethyst
(To:ahmed123)

https://academic.cloud.thingworx.com/Thingworx/Things/salesforceThing_ahmed123/Services/setTempAndHumid?appKey=putAppKeyHere&method=post&x-thingworx-session=true&Temp=30.00&Humid=28.00

 

Remove the <> brackets and the post url will work.  Also, I would not post clear text appKeys.  Anyone can gain access to your instance with them.

 

Thanks,
Adam

ahmed123
4-Participant
(To:AdamR)

Hello Adam,

 

Thanks for reply,

char server[] = "https://academic.cloud.thingworx.com/Thingworx/Things/salesforceThing_ahmed123/Services/setTempAndHumid?appKey=03bbedef-bb57-4ec1-9cad-8126d72d2e75&method=post&x-thingworx-session=true&Temp=30.00&Humid=28.00";

 

I made changes as you mention above, but still I'm not seeing thingworx property values updates, is somewhere else I'm doing wrong?

 

DHT22 Library Demo
Trying to get an IP address using DHCP
My IP address: 192.168.0.38
Humidity: 22.00 % Temperature: 29.00 *C 84.20 *F Heat index: 27.52 *C 81.53 *F
Humidity: 22.00 % Temperature: 29.00 *C 84.20 *F Heat index: 27.52 *C 81.53 *F
connected
POST /Thingworx/Things/salesforceThing_ahmed123/Services/setTempAndHumid?appKey=03bbedef-bb57-4ec1-9cad-8126d72d2e75&method=post&x-thingworx-session=true&Temperature=29.00&Humidity=22.00 HTTP/1.1
Host: https://academic.cloud.thingworx.com/Thingworx/Things/salesforceThing_ahmed123/Services/setTempAndHumid?appKey=03bbedef-bb57-4ec1-9cad-8126d72d2e75&method=post&x-thingworx-session=true&Temperature=30.00&Humidity=28.00
Content-Type: text/html

 

I'm very thankful to you if this get resolve.

 

Thanks,

Ahmed

Top Tags