Getting a specific record

Apr 28, 2011 at 2:47 PM

Hi.

What is the best way to get the "thing" whose thingId is known (by thingId, I mean the unique identifier that is returned by  thing.getThingId().getValue())? In my case, I have a local copy of the records in my local database, including their id's and I want to be able to change, say, the value of a field in this record and then update the Health Vault record accordingly.  So I am trying to approach this by first getting the same exact "thing" object from the Health Vault based on the id of the record that I have saved locally, then modify certain fields in that "thing" as needed and the update the Health Vault. Looking at the ThingFilterSpec, I couldn't see any easy way to get a "thing" based on its id, so is there a way to achieve that?

 

Many thanks

Ali.

Coordinator
Apr 28, 2011 at 5:54 PM
Edited May 2, 2011 at 5:06 AM

Hi Ali,

Things have a compound key:  thing-id, version-stamp.  This pair is represented by the Thing's ThingKey. 

Thing thing-id remains the same for the lifetime of the Thing.  As you update a Thing, the version-stamp changes.  To obtain the latest version, pass only the thing-id when calling GetThings.  However, when updating a Thing, the entire key is used to ensure you are updating the latest Thing. 

You can set a list of thing-ids directly on the ThingRequestGroup. 

 

ThingRequestGroup group = new ThingRequestGroup();
group.getId().add("11111111-1111-1111-1111-111111111111");

 

--Rob