Avatar

Trip data filtered by parent group

0

Hi All

I am trying to get the trip data from the API for a parent group.

The devices in the trip data have the groups as the 4th child tier, what i am trying to get are these trips but for the associated parent group on the 2nd tier just below the Company Group.

So basically i need to call the API for trips and have all the data returned but with a search on the 2nd Tier group name but the data returned will be for all the subsequent children.

Don't know if that made sense.

Thanks

 

Brian Connell

Official comment

Avatar

Hi Brian,

I would recommend splitting the tasks into two parts, similar to what Michael has mentioned:

  1. The first part should be to return a list of all the devices you want and then store the devices in an object.
  2. Then you should run a loop that goes through each device in the object and makes another API call to return the device's trips.

Here is a link to our API reference guide:
https://my.geotab.com/sdk/#/api 

I recommend looking at the following calls as they should help you return data relevant to what you are searching for:

  • TripSearch
  • DeviceSearch
  • GroupSearch
Glenn Sandrasagra

Please sign in to leave a comment.

2 comments

0
Avatar

There are different ways to do this and the correct way depends on how many devices you expect, how many trips, etc..  You can get your device list from get device with the group in tier 2.  Then loop through and get all trips in a multicall for each device.  You could also just get all trips and drop the ones you don't need which would prove to be fast for a small group of vehicles in a small date range.  

Bottom line is to kind of know what data you are expecting based on quantity of devices and/or date range along with the speed at which you need the response..  This will determine the best method.

Michael Head 0 votes