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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Arduino Uno weather app REST call not updating thing properties

apundhir
1-Visitor

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/2AUHowtoReadTemperatureandHumidityfromHTU21DSensorUsingRestCallsinCforArduinoUno.ashx?la=en

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

ACCEPTED SOLUTION

Accepted Solutions
vmihai
12-Amethyst
(To:apundhir)

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

View solution in original post

7 REPLIES 7
vmihai
12-Amethyst
(To:apundhir)

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

apundhir
1-Visitor
(To:vmihai)

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=12.04&Humid=12.17>

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

vmihai
12-Amethyst
(To:apundhir)

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

apundhir
1-Visitor
(To:vmihai)

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?appKey=<Key from my application key>-1918-4ad8-961f-f22c50a02&method=post&x-thingworx-session=true<&Temp=32.04&Humid=12.17>

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

vmihai
12-Amethyst
(To:apundhir)

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

lzhou-2
2-Explorer
(To:vmihai)

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

vmihai
12-Amethyst
(To:lzhou-2)

Sure, no problem.

Announcements


Top Tags