Get Things Filter

May 19, 2011 at 7:12 PM

Hello,

 

I am using filters in GetThings methodlike this :

 

 

ThingRequestGroup group = new ThingRequestGroup();

ThingFilterSpec filter = new ThingFilterSpec();

filter.getTypeId().add("ca3c57f4-f4c1-4e15-be67......");

filter.getTypeId().add("3d34d87e-7fc1-4153-800f......");

Calendar cal1 = Calendar.getInstance();

cal1.set(Calendar.MINUTE, cal1.get(Calendar.MINUTE-5));

GregorianCalendar c1 = new GregorianCalendar();

c1.setTimeInMillis(cal1.getTimeInMillis());

XMLGregorianCalendar date1 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c1);

filter.setCreatedDateMin(date1);

filter.setUpdatedDateMin(date1);

group.getFilter().add(filter);
ThingFormatSpec format = new ThingFormatSpec();
format.getSection().add(ThingSectionSpec.CORE);
format.getSection().add(ThingSectionSpec.AUDITS);
format.getXml().add("");
group.setFormat(format);

GetThingsRequest info = new GetThingsRequest();


info.getGroup().add(group);

GetThingsResponse response = (GetThingsResponse)requestTemplate.makeRequest(info);

 

 

Things are working fine but wanted to know about :

filter.setCreatedDateMin(date1);

filter.setUpdatedDateMin(date1);

I have created the Calendar object and want any updated things (BP, Weight) in the last 5 minutes

The problem I am facing is that the timestamp I get when I query without filter is <timestamp>2011-05-19T12:30:30.94Z</timestamp>

and I can see the request contains create date and update filters as :

<created-date-min>2011-05-19T17:30:54.779+05:30</created-date-min><updated-date-min>2011-05-19T17:30:54.779+05:30</updated-date-min>

 

I think there is some problem with the time zone.

 

Please Help....

Thanks,

Amit Goyal

Coordinator
May 22, 2011 at 11:16 PM

Hi Amit,

Try using UTC time.  All times received from HealthVault will be in UTC.

Calendar.getInstance(TimeZone.getTimeZone("UTC"))

-Rob