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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Thingworx REST Call not working with a different browser, as well as Python

mhassan1
2-Guest

Thingworx REST Call not working with a different browser, as well as Python

Basically, I'm trying to demo by connecting an ultrasonic sensor to my local H2 based Thingworx Copy.

When running Thingworx on localhost on Chrome, On a new tab, If I try to run this URL below to run service which sets the value of my Ultrasonic Sensor:-

http://localhost:8080/Thingworx/Things/UltraSonicSensor/Services/setDistance?appKey=6cc0dd07-c78a-4548-9109-b2c9cbe7298e…

Then it works and mashup also updates.

However, if I try to run the same link with another browser, it doesnt work. Also, if I try to run this same link  with Python using requests.post("http://localhost:8080/Thingworx/Things/UltraSonicSensor/Services/setDistance?appKey=6cc0dd07-c78a-4548-9109-b2c9cbe7298e…"), It still doesn't work.

Please help.

ACCEPTED SOLUTION

Accepted Solutions
supandey
19-Tanzanite
(To:mhassan1)

Muhammad, you might want to recheck the appKey as Dinesh has mentioned, additionally try testing your REST call using Postman it should be really fast and easy to debug the issue.

It could be possible that it works under Chrome in different tab because the session has the require data to authenticate, did you test in the Incognito Mode?

View solution in original post

5 REPLIES 5
ds-21
1-Newbie
(To:mhassan1)

Hi Muhammad Hassan,

     you should do small change  subsystem,if you are using 6.0 or later. you should do this,

Go to Systems> subsystem>PlatformSybsystem in composer.Within the subsystem, open configuration and check the box next to Allow Request Method Switch and un-check the box next to Filter Content-Type. refer the attachment.


platformSubsystem.PNG

Thanks,

DINESH


I've already done that configuration in my browser.

I receive no errors when I use Chrome to execute the command. (When thingworx local instance is running on Chrome)

This is the error I get when I try to run it in Firefox:-

This is the error I get in Python as well:-

ds-21
1-Newbie
(To:mhassan1)

Hi Muhammad Hassan,

         configuration was correct. I think you should check the AppKey. you should also check the current user (loggedin) has  Appkey or not?

might be this will be reason you will gettting this error.

Thanks

DINESH

supandey
19-Tanzanite
(To:mhassan1)

Muhammad, you might want to recheck the appKey as Dinesh has mentioned, additionally try testing your REST call using Postman it should be really fast and easy to debug the issue.

It could be possible that it works under Chrome in different tab because the session has the require data to authenticate, did you test in the Incognito Mode?

It seems I was using wrong App Key =P..

Positive point I noted from this thread is that even if you put wrong app key in the same session which is authenticated, It still works even if you're using wrong app key.

Thanks for the help Guys.

Announcements


Top Tags