Back to index

GetGPSReadings_v1

This function can be used to retrieve the GPS readings.

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
[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.

If a truck loses GPRS connection for 2 hours and then it connects back, all the records that were generated during those 2 hours will be sent to the server and consequently to the database at the time when the GPRS connection is restored. This means that in this scenario we might get records that have the TimeStamp 2 hours back while the RecordTimestamp will contain the current server time. If all clocks are synchronized, in this scenario for the first record there is an approximately two hours difference between the RecordTimeStamp and the TimeStamp.

This API is designed for mirroring the data i.e. building up another database. Please use the startTimeStamp input argument and RecordTimeStamp column to see until what point the data has been received and use the TimeStamp column as the time of the record in your application.

Error messages

Please see this page.