echolist
Posts: 25
Joined: Tue Sep 01, 2015 8:20 am
Location: Indonesia
Contact: Website

get latest record from webservice

Tue Dec 15, 2015 3:29 am

hello,
i have problem with webservice, i can create a webservice like these :

Code: Select all

var user = request.queryParams.get('user');
var pass = request.queryParams.get('pass');
var login = auth.login(user, pass);
var no_vehicle = request.queryParams.get('vehicleId');
 
response.body = directory.getLatestRecords(no_vehicle).toString();

this webservice can run with id of unit.
But, can i get getLatestRecord with other field like username, name or custom field ?

---
i think the result of getLatestRecord for OdometerAcc is not accurate because i compare with latest history from ggs is different. Or maybe there is any calculate to get a valid odometer ?
or can i get odometer system ? ( not from device)

thank you

regards,
echolist

User avatar
Gabor
GpsGate
Posts: 86
Joined: Thu May 16, 2013 3:43 pm

RE: get latest record from webservice

Tue Dec 15, 2015 12:26 pm

Hello,

1) Currently we only have API functions to get a given user by id or IMEI.
If you need to get a user by name, use directory.getUsers() to get the list of users.
You can filter that list based on your criteria.

2) To get the odometer, use directory.getLatestAccumulatorValues(iUserID);

3) There is a customFields.getValues("user", iObjectID) function to query the customfields of the specified user.

Tip:
You can use the tree view in the script editor to discover the API.
If you click on the return type (gray text at the end) of a function in the tree view,
you will get the detailed description of the result in the help area.
The log() function can also come in handy when developing a script to print the value to the output panel.
Example: log(directory.getUsers());



Regards,
Gabor
GpsGate Support

echolist
Posts: 25
Joined: Tue Sep 01, 2015 8:20 am
Location: Indonesia
Contact: Website

RE: get latest record from webservice

Wed Dec 16, 2015 6:27 am

Originally posted by Gabor

Hello,

1) Currently we only have API functions to get a given user by id or IMEI.
If you need to get a user by name, use directory.getUsers() to get the list of users.
You can filter that list based on your criteria.

2) To get the odometer, use directory.getLatestAccumulatorValues(iUserID);

3) There is a customFields.getValues("user", iObjectID) function to query the customfields of the specified user.

Tip:
You can use the tree view in the script editor to discover the API.
If you click on the return type (gray text at the end) of a function in the tree view,
you will get the detailed description of the result in the help area.
The log() function can also come in handy when developing a script to print the value to the output panel.
Example: log(directory.getUsers());



Regards,
Gabor
GpsGate Support


thank you sir, but how to increase max step ? i have error like this :

Code: Select all

Max execution steps exceeded (300) 
Line: 37 Char: 1 
my code :

Code: Select all

var user = directory.getUsers();
for (var i = 0; i < user.length;i++){
	var name = user[i]['name'];
	log(name);
  }
regards,
echolist

User avatar
Gabor
GpsGate
Posts: 86
Joined: Thu May 16, 2013 3:43 pm

RE: get latest record from webservice

Wed Dec 16, 2015 11:34 am

Please write an email to support[at]gpsgate.com regarding WebServiceScript execution step limit.


Regards,
Gabor
GpsGate Support

Return to “GpsGate for Developers”