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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Using thing Identifers in REST API calls

pschmaltz
10-Marble

Using thing Identifers in REST API calls

From a recorded presentation I watched by Mike Mahoney regarding the Connection process, I gathered that I should be able to use a thing's Identifier as an (often better) way to manage uniquely referencing a thing from the EMS/REST API calls etc.

Can someone tell me how I would revise REST calls like this to use the identifier (DL1 above) instead of the thing name (Name_DemoDL1) as it is currently doing?

curl -X GET -H "Content-Type:application/json" -H "Accept:application/json" -H "appKey:0a2c50d9-4ed3-40df-aad5-98c57035a204" http://localhost/Thingworx/Things/Name_DemoDL1/Properties/TEMP

Simply swapping the name out for the identifier doesn't seem to work. Is there some other platform service setting I need to enable? Or merely some format for how one specifies to the REST API that it is the identifier you are passing not the name?


TIA.

4 REPLIES 4

I'm still curious to know more about using the thing Identifier in our API calls. TIA if anyone has info about this you can share.

Mike Mahoney was most likely specifically referring to using the identifier to bind the thing to the EMS server as opposed to the thing name.  The REST APIs still require you to use the thing name.

I'm not sure it is true that the REST API requires use of thingName and doesn't accept use of the thing Identifier. What I recently learned was that if I added a * in front of the thing Identifier the following URL does work:

http://(your instance)/Thingworx/Things/*ThingIDxyz/Properties

So doesn't that suggest that the REST API knows how to find things via their IDs (not just the thing name) so long as you put a * in front of the thing ID? Or is my test with the above URL not valid?

tcoufal
12-Amethyst
(To:pschmaltz)

I've tried it and it works. But you can assign the same identifier to more than one Thing. I don not yet know why would anyone do that, but you can and it could complicate things a bit. Both ways could have merits.

T

Top Tags