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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

RemoteThing and REST API

gkumar-21
5-Regular Member

RemoteThing and REST API

Hi,

I have general question about RemoteThing and REST API

Why is that I am not able to use REST API to modify properties of a Thing which a RemoteThing as template ?

When I go through documentation, I understand we need to use  Edge Microserver to set property values.

 

Is there a way to use  REST API ( say using curl or postman) to set and get property values. If now what the reason behind it ?

 

3 REPLIES 3
supandey
19-Tanzanite
(To:gkumar-21)

Hi @gkumar-21 its definitely possible to to do GET/PUT/POST, etc. using the ThingWorx REST API, both with Postman or cURL lib. I'm not sure how you are trying may be the syntax is incorrect? As you can see below I'm performing a GET request using Postman with desired results

 

25-06-2018 16-31-18.jpg

 

If you have not already explored the documentation on this, you can refer to this link ThingWorx REST API, it'll help you correctly structure your calls to ThingWorx 

gkumar-21
5-Regular Member
(To:supandey)

Hi   supandey

Thanks a lot for the response. 

Let  me make the question a little more in details

I have used REST API to send and receive information from thing using CURL and Postman and it works fine. This is about a normal thing.  

I have created a thing (let us called  SensorThing) While creating SensorThing, I had used a pre-defined Template Called RemoteThing. To my understanding this  template is used when we need a "ALWAYS ON" Connection.  

 

Next step what I did was send data (PUT) to thing this using postman or CURL, but the data is not reflected in the properties of thing.  I looked at the guides and able to understand that they are using a JAVA-SDK based program for sending data to this thing. I also understood that C-SDK or JAVA SDK is used for creating an "ALWAYS ON" connection. with thing.

 

My question

1. is there are limitation in using plain simple REST API to send data to a thing which inherits (Remote Thing template ? 
2.When exactly we use Remote Template while creating a thing

gkumar-21
5-Regular Member
(To:gkumar-21)

Hi

Today I was able to get the answer for this this question

 

RemoteThing is a template exclusively used when Things are making of websockets (Note: WebSockets are an advanced technology that makes it possible to open an interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.)

 

RemoteThing is the naming convention for using Web sockets to communicate to another node, or Thing, in the network.

 

REST API  is HTTP based interface which  over TCP/IP sockets  

So the conclusion I have arrived is RemoteThing is inherited by Thing when it has to establish a connection over websockets.

Where as when we use other thing template it possible to use REST API using tools like cURL or Postman

 

Announcements


Top Tags