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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

REST API - Filter Example

vieirac1
9-Granite

REST API - Filter Example

Hi Team,

 

Please, how can we query via REST API, things like in the following scenario:

·    Things are defined with Location and Temperature properties

·    Customer will have an external application to query all Things temperatures from a particular location (filter things by location and retuning only temperature)

 

Tks,

Chris

1 ACCEPTED SOLUTION

Accepted Solutions
Radu
15-Moonstone
(To:vieirac1)

The difference is that GetImplementingThingsWithData() returns all the Things that are part of the Thing Template that contains your service, whereas QueryImplementingThingsWithData() does the same, but only returns the Things that respect a certain query. More info on how to use queries are found here.

 

If it is not of any help, you can try the first method. You can iterate through all the things returned by GetImplementingThingsWithData() and return only the ones that meet certain criteria.

 

View solution in original post

3 REPLIES 3
Radu
15-Moonstone
(To:vieirac1)

Hi vieirac1,

 

I imagine these Things with Location and Temperate properties share the same Thing Template. If so, you can create a service on the template that interrogates all the implementing Things ( using GetImplementingThingsWithData() ) and checks whether their Location property matches the Location service parameter, returning the temperature if so.

 

Is this the approach you're looking for?

vieirac1
9-Granite
(To:Radu)

Hi,

Tks and should I use GetImplementedthingswithdata or queryimplementedthingswithdata?

What is the main difference?

Tks

Chris Vieira
Radu
15-Moonstone
(To:vieirac1)

The difference is that GetImplementingThingsWithData() returns all the Things that are part of the Thing Template that contains your service, whereas QueryImplementingThingsWithData() does the same, but only returns the Things that respect a certain query. More info on how to use queries are found here.

 

If it is not of any help, you can try the first method. You can iterate through all the things returned by GetImplementingThingsWithData() and return only the ones that meet certain criteria.

 

Top Tags