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

Arduino Uno weather app REST call not updating thing properties

SOLVED
Highlighted
Level 1

Arduino Uno weather app REST call not updating thing properties

Hi All, I am new to thingworx and trying to complete the Arduino Uno weather app from the tutorial provided on the following link:

Weather App with Arduino Uno | ThingWorx

I am using a developer account and ThingWorx Composer 6.0. I am stuck at the following part of tutorial:

http://www.thingworx.com/~/media/Files/PDFs/Academics/2AUHowtoReadTemperatureandHumidityfromHTU21DSe...

This primarily deals with updating the temp and humid values using REST call in the thing properties. The structure of the REST call that I have even tried from REST clients is following:

POST /Thingworx/Things/DHT11Thing/Services/setTempAndHumid?appKey=8510MYAPPKEY-1918-4ad8-961f-475f22c50a02&method=post&x-thingworx-session=true<&Temp=32.04&Humid=12.17> HTTP/1.1

Host: geX-XXX.cloud.thingworx.com    {This is my thingworx account link to composer}

Content-Type: text/html

Any pointers on what I may be doing wrong.

P.S. I amusing a DHT11 temperature sensor so my thing name is matching with the thing name I have created on ThingWorx.

Thanks,

Avinash

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Arduino Uno weather app REST call not updating thing properties

Hi,

On ThingWorx 6.0  REST calls  need to be enabled  by following these steps :

1.           Click on Subsystems under SYSTEM within the left pane of Composer

2.            Click on PlatformSubsystem

3.            Click on Configuration

4.            Check the box next to Allow Request Method Switch to allow all REST API calls through a browser URL

5.            Uncheck Filter Content-Type

Let me know if this fixes the issue,

Veronica

7 REPLIES 7

Re: Arduino Uno weather app REST call not updating thing properties

Hi,

On ThingWorx 6.0  REST calls  need to be enabled  by following these steps :

1.           Click on Subsystems under SYSTEM within the left pane of Composer

2.            Click on PlatformSubsystem

3.            Click on Configuration

4.            Check the box next to Allow Request Method Switch to allow all REST API calls through a browser URL

5.            Uncheck Filter Content-Type

Let me know if this fixes the issue,

Veronica

Re: Arduino Uno weather app REST call not updating thing properties

Thanks a lot Veronica, I was able to POST data using REST call.


I have another doubt regarding the Application Key based authentication, that I am using in my REST call.

To be precise I am using the following POST:

http://ge<MYMACHINE>.cloud.thingworx.com/Thingworx/Things/DHT11Thing/Services/setTempAndHumid?<&Temp...

It seems like I am able to POST data without application key authentication. What settings I need to correct to put application key authentication for my thing?

Thanks,

Avinash

Re: Arduino Uno weather app REST call not updating thing properties

Hi Avinash,

Are you making the rest call in a browser ? Maybe you are already logged in and this is why you are no longer required to input an authentication key as alternative for log in. Use also the following parameter in your Rest call : x-thingworx-session=true. This will create a  thingworx session for your rest call.

Veronica

Re: Arduino Uno weather app REST call not updating thing properties

Hi Veronica,

I closed browsers, cleared cache and now when I am trying to get the call:

http://ge<MY MACHINE>.cloud.thingworx.com/Thingworx/Things/DHT11Thing/Services/setTempAndHumid?appKe...

This call is throwing me a 401 unauthorized error. I believe I am missing some setting linked with application key authentication process.

Just an additional pointer I am using browser extension for REST in chrome to make REST calls.

Thanks,

Avinash

Re: Arduino Uno weather app REST call not updating thing properties

Hi Ainash,

There shouldn't be any additional configuration to be done. Just make sure that you copied the entire app key It should be 36 characters long, including the little dashes. Also make sure that you have assigned the user you are logged in with as the owner of the key.

I hope this solves the issue.

Veronica

2015-09-22_1654.png

Re: Arduino Uno weather app REST call not updating thing properties

I have got it. thanks, never mind my question in other issue about this problem

Re: Arduino Uno weather app REST call not updating thing properties

Sure, no problem.