Avatar

upgrading from 5.6 to 5.7: yet another feed question

0

If make a call to GetFeed for StatusData for each vehicle using to and from dates - something like this...

    feedStatusData = _api.Call<FeedResult<StatusData>>("GetFeed", new
    {
        typeName = typeof(StatusData).ToString(),
        search = new StatusDataSearch
        {
            FromDate = fromDate,
            ToDate = toDate,
            deviceSearch = new DeviceSearch
            {
                 id = device.Id
             }

        }

    });

...I will have access to feedStatusData.ToVersion. 

So, after going through all 300 vehicles and making this call, what will the final feedStatusData.ToVersion get me? Is it tied to the vehicle in some way? If I make a GetFeed StatusData call later using that version number but don't pass device search, will I get what I think I should get: all records for all devices posted since the last device-specific feed I had requested?

Does that make any sense?

 

Mark Faucher

Please sign in to leave a comment.

5 comments

Avatar

Hey Mark,

So, after going through all 300 vehicles and making this call, what will the final feedStatusData.ToVersion get me?

The the result at index 299 would be the toVersion of the status data record for last result in the feedStatusData.Data or version 0 if there is no data found.

 

Is it tied to the vehicle in some way?

It is the last record token for status data that was returned using the search provided. The token is not tied to the vehicle, the status data is. There is no information about the search you used encoded in the version.

 

If I make a GetFeed StatusData call later using that version number but don't pass device search, will I get what I think I should get: all records for all devices posted since the last device-specific feed I had requested?

If you don't pass in a device search, you will get back all records (for any device) that have been added (or possibly changed for calculated data - ex exception events) since the version you supply.

 

Steve

0
Comment actions Permalink
Steve Hansen 0 votes
Avatar

Mark,

You may want to try to pass in a group(that all devices are in) for that device search object so you are not running that call 300 times like you are saying you are doing initially.  That would save you 299 calls.  LOL.

Michael

0
Comment actions Permalink
Michael Head 0 votes
Avatar

Mark,

Sorry.

Actually that device search with the groups is not available on the "StatusDataSearch" or "LogRecordSearch". 

It is available on the device search object of the "DeviceStatusInfoSearch" and "RouteSearch"

Maybe they can add that for the device search object in "StatusDataSearch" then it would benefit you.

Michael

0
Comment actions Permalink
Michael Head 0 votes
Avatar

Steve (or anyone) - I have found what appears to be a huge problem with feeds...I think.

Can I just confirm:

If I make a call per device to get feeds for a daterange, I should be able to use the latest returned versionnumber to make a call without passing device and I will get unique data, right?

So, 

FeedResult<LogRecord> feedLogRecordData = _api.Call<FeedResult<LogRecord>>("GetFeed", new
{
     typeName = typeof(LogRecord).ToString(),
     search = new LogRecordSearch
     {
          FromDate = start,
          ToDate = end,
          DeviceSearch = new DeviceSearch
          {
               Id = device.Id
          }
     }
});

...in a foreach of devices.

Then if I use the last versionnumber returned, I can be safe in making this call...

feedLogRecordData = _api.Call<FeedResult<LogRecord>>("GetFeed", new
{
     typeName = typeof(LogRecord).ToString(),
     fromVersion = VersionNumber
});

...and all records will be unique, right?

0
Comment actions Permalink
Mark Faucher 0 votes
Avatar

Hey Mark,

You could receive duplicate results back in the logic you describe above.

The token is only related to the call it was returned from. It won't have any knowledge of previous calls. Thus in the non device specific call made second, using the token for which ever the last device was is only the last know record meeting your search.

Here's simplified illustration to help explain what is happening:

2014-05-08_11_56_43-Untitled_spreadsheet_-_Google_Sheets.png

0
Comment actions Permalink
Steve Hansen 0 votes