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

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

SOLVED
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-45...

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-45..."), It still doesn't work.

Please help.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

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

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
Highlighted

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

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


Highlighted

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

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:-

Highlighted

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

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

Highlighted

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

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

Highlighted

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

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

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________