Back to index

GetGPSReadingsForVehicle_v1

This function can be used to retrieve the GPS readings for a particular vehicle.

Parameters:

[in] usn The user-name that you need to use to authenticate on this interface.
[in] pwd The password that you need to use to authenticate on this interface.
[in] requestedRowNumber The number of rows that you would prefer to get in one set.
[in] columns String array of the requested columns. For the full list of supported columns please refer to the Database API Documentation. If a non-existing column is requested then that column will appear in the returned XML and every entry in that column will be an empty string.
[in] startTimeStamp The timestamp for and after which you would like to retrieve the data. Please make sure that you specify the time in utc.
[in] options Optional parameters seperated by semicolon: ("option1=value1;option2=value2"). Pass an empty string for no options; supported options: "UseMillisecondResolution=True" to return datetime values with millisecond resolution
[in] vehicleID This is the ID of the vehicle to return data for. The method returns data for the specified vehicle.
[out] lastTimeStamp The timestamp of the latest entry in the set, in utc. Use this value as startTimeStamp to query the following set of rows for the same query.
[out] errorMsg If an error happpens this string contains the error message. In case an error has happened (this variable contains a valid non-empty string) then the return value will not contain any usable data, do not try to parse it as an xml.
[out] ajustedRowNumber Under some circumstances it might happen that the web-service cannot use the requestedRowNumber to execute the query therefore it needs to adjust it. This value reveals the real row number that was used to perform the query. For more information see "Retrieving large amount of data" in the remarks.
return value If the errorMsg variable is null or empty then the returned string contains the requested data in xml format. The xml has the following structure:
<root>
<EX_GPSReadings>
  <row VehicleID="103" VehicleName="20"
   RecordTimeStamp="2011-03-28 17:36:01Z"
   Latitude="51.8995233333333" Longitude="-8.941265"
   Odometer="" />
  <row VehicleID="83" VehicleName="07"
   RecordTimeStamp="2011-03-28 17:36:04Z"
   Latitude="53.17268" Longitude="-7.74041666666667"
   Odometer="" />
</EX_GPSReadings>
</root>
Please note this.

Remarks

Minimum R-COM Database version

0.708

Retrieving large amount of data

You cannot use this function to retrieve infinitely large amount of data in one call. In case you would like to get a large set of rows you will need to call this function several times. You can specify your preference about the number of rows returned in one function-call in requestedRowNumber. If it is possible the webservice will use this number, but there are circumstances in which the webservice needs to adjust this number for performing the query. The real row number that was used for performing the query is retuned in ajustedRowNumber.

To find out whether there is more data that was not returned with the previous call you should compare ajustedRowNumber with the number of rows in the returned xml. If these two numbers match then it is likely that there are more rows to return. If the number of rows in the returned xml is smaller than ajustedRowNumber then most probably you have retrieved all the data for now. No new rows will be returned until new data gets saved.

If you want to fetch the next set of data, you need to remember the value of lastTimeStamp from the last call and pass that value in as startTimeStamp to query the following set of rows.

There is a chance that you get the same rows more than once, your application needs to be prepared to handle this case.

TimeStamps

There are 2 timestamp columns in this table, the column 'TimeStamp' contains the GPS TimeStamp, the column 'RecordTimeStamp' contains the time the data was saved to the database.

The lastTimeStamp and startTimeStamp parameters in the API description both refer to RecordTimeStamp and the returned data is sorted by RecordTimeStamp.

Error messages

Please see this page.