GPS-server.net HTTP API 1.
3
Last updated: 2016-08-02
Access to API
1. API is accessed via HTTP URL:
Example
SERVER_DOMAIN/api/api.php
2. Additionally to this you must choose which one API to use, server or user. Also API version should be set in HTTP URL:
Example
SERVER_DOMAIN/api/api.php?api=server&ver=1.0
SERVER_DOMAIN/api/api.php?api=user&ver=1.0
3. Server API identification is done using key, which can be found in CPanel under Super Administrator account, in running GPS-server.exe application or config.php
under $gsValues['HW_KEY'] variable:
Example
SERVER_DOMAIN/api/api.php?api=server&ver=1.0&key=ABCABCABCABCABCABCABCABCABCABCAB
4. User API identification is done using key, which can be found in user account settings accessed via CPanel:
Example
SERVER_DOMAIN/api/api.php?api=user&ver=1.0&key=ABCABCABCABCABC
Command structure
HTTP variable “cmd” contains command and parameters. Command and parameters are split by comma. Command can have multiple parameters, every
parameter is split by comma also.
Example
SERVER_DOMAIN/api/api.php?api=server&ver=1.0&key=ABCABCABCABCABCABCABCABCABCABCAB&cmd=ADD_USER,email@email.com
ADD_USER - command
email@email.com - parameter
Server API
Server API allows executing server related commands.
Example
SERVER_DOMAIN/api/api.php?api=server&ver=1.0&key=ABCABCABCABCABCABCABCABCABCABCAB&cmd=COMMAND
ADD_USER
Registers new user accounts with e-mail.
Command structure
Command ADD_USER
Parameter #1 E-mail address
Example
SERVER_DOMAIN/api/api.php?api=server&ver=1.0&key=ABCABCABCABCABCABCABCABCABCABCAB&cmd=ADD_USER,email@email.com
DEL_USER
Deletes user account.
Command structure
Command DEL_USER
Parameter #1 E-mail address
Example
SERVER_DOMAIN/api/api.php?api=server&ver=1.0&key=ABCABCABCABCABCABCABCABCABCABCAB&cmd=DEL_USER,email@email.com
ADD_OBJECT
Adds object to system.
Command structure
Command ADD_OBJECT
Parameter #1 Object IMEI
Parameter #2 Object name
Parameter #3 Object activity period date, format: YYYY-MM-DD
Example
SERVER_DOMAIN/api/api.php?api=server&ver=1.0&key=ABCABCABCABCABCABCABCABCABCABCAB&cmd=ADD_OBJECT,123456789012345,Car,2016-01-01
DEL_OBJECT
Deletes object from system.
Command structure
Command DEL_OBJECT
Parameter #1 Object IMEI
Example
SERVER_DOMAIN/api/api.php?api=server&ver=1.0&key=ABCABCABCABCABCABCABCABCABCABCAB&cmd=DEL_OBJECT,123456789012345
ADD_USER_OBJECT
Adds object to user account.
Command structure
Command ADD_USER_OBJECT
Parameter #1 User account e-mail
Parameter #2 Object IMEI
Example
SERVER_DOMAIN/api/api.php?api=server&ver=1.0&key=ABCABCABCABCABCABCABCABCABCABCAB&cmd=ADD_USER_OBJECT,email@email.com,12345678901
2345
DEL_USER_OBJECT
Deletes object to from user account.
Command structure
Command DEL_USER_OBJECT
Parameter #1 User account e-mail
Parameter #2 Object IMEI
Example
SERVER_DOMAIN/api/api.php?api=server&ver=1.0&key=ABCABCABCABCABCABCABCABCABCABCAB&cmd=DEL_USER_OBJECT,email@email.com,12345678901
2345
OBJECT_SET_ACTIVITY
Sets object activity period.
Command structure
Command OBJECT_SET_ACTIVITY
Parameter #1 Object IMEI
Parameter #2 Object activated, options: true or false
Parameter #3 Object activity period date, format: YYYY-MM-DD
Example
SERVER_DOMAIN/api/api.php?api=server&ver=1.0&key=ABCABCABCABCABCABCABCABCABCABCAB&cmd=OBJECT_SET_ACTIVITY,123456789012345,true,2016
-01-01
User API
User API allows executing user account related commands.
USER_GET_OBJECTS
Get object list of current user account.
Command structure
Command USER_GET_OBJECTS
Example
SERVER_DOMAIN/api/api.php?api=user&ver=1.0&key=ABCABCABCABCABC&cmd=USER_GET_OBJECTS
OBJECT_GET_CMDS
Get object commands which were sent for execution.
Command structure
Command OBJECT_GET_CMDS
Parameter #1 Object IMEI
Example
SERVER_DOMAIN/api/api.php?api=user&ver=1.0&key=ABCABCABCABCABC&cmd=OBJECT_GET_CMDS,111111111111111
OBJECT_CMD_GPRS
Send ASCII or HEX command to object using GPRS gateway.
Command structure
Command OBJECT_CMD_GPRS
Parameter #1 Object IMEI
Parameter #2 Command name
Parameter #3 Type (HEX or ASCII)
Parameter #4 Command, if command type is ASCII it is important to use quotes (")
Example
SERVER_DOMAIN/api/api.php?api=user&ver=1.0&key=ABCABCABCABCABC&cmd=OBJECT_CMD_GPRS,111111111111111,TEST,ASCII,"COMMAND_TEXT"
SERVER_DOMAIN/api/api.php?api=user&ver=1.0&key=ABCABCABCABCABC&cmd=OBJECT_CMD_GPRS,111111111111111,TEST,HEX,AABBCC
OBJECT_CMD_SMS
Send command to object using SMS gateway.
Command structure
Command OBJECT_CMD_SMS
Parameter #1 Object IMEI
Parameter #2 Command name
Parameter #3 Command, it is important to use quotes (")
Example
SERVER_DOMAIN/api/api.php?api=user&ver=1.0&key=ABCABCABCABCABC&cmd=OBJECT_CMD_SMS,111111111111111,TEST,"COMMAND_TEXT"
OBJECT_GET_LOCATIONS
Get object(s) last know location data in JSON format.
Command structure
Command OBJECT_GET_LOCATIONS
Parameter #1 Object IMEI, for multiple IMEIs separate them via semicolon
Example
SERVER_DOMAIN/api/api.php?api=user&ver=1.0&key=ABCABCABCABCABC&cmd=OBJECT_GET_LOCATIONS,111111111111111;222222222222222
OBJECT_GET_MESSAGES
Get object location messages for set period of time in JSON format.
Command structure
Command OBJECT_GET_MESSAGES
Parameter #1 Object IMEI
Parameter #2 Date and time from, format: YYYY-MM-DD HH:MM:SS
Parameter #3 Date and time to, format: YYYY-MM-DD HH:MM:SS
Example
SERVER_DOMAIN/api/api.php?api=user&ver=1.0&key=ABCABCABCABCABC&cmd=OBJECT_GET_MESSAGES,111111111111111,2016-01-01 00:00:00,2016-02-01
00:00:00
GET_ADDRESS
Get address from latitude and longitude using server geocoders.
Command structure
Command GET_ADDRESS
Parameter #1 Latitude
Parameter #2 Longitude
Example
SERVER_DOMAIN/api/api.php?api=user&ver=1.0&key=ABCABCABCABCABC&cmd=GET_ADDRESS,54.684314,25.285398
Location API
Location API allows location data insertion to database. Special identification is not needed. It can be used by GPS device manufacturers or smartphone application
developers who look for an easy way to transmit location data to server via HTTP GET.
Location structure
imei GPS object identifier
dt Date and time, format: YYYY-MM-DD HH:MM:SS, time zone: 0 UTC
lat Latitude
lng Longitude
altitude Altitude in meters
angle Angle in degree
speed Speed in km/h
loc_valid 1 is for valid GPS location, 0 is for invalid GPS location
params Additional parameters for sensors, all should be split by “|” character. More
details: http://gps-server.net/docs/user-manual/sensor-parameters
event Possible events: sos, bracon, bracoff, mandown, shock, tow, haccel, hbrake,
hcorn, pwrcut, gpscut, lowdc, lowbat, jamming
LOCATION
Example
SERVER_DOMAIN/api/api_loc.php?imei=123456789012345&dt=2016-01-01
00:00:00&lat=54.000000&lng=25.000000&altitude=100&angle=45&speed=60&loc_valid=1¶ms=batp=100|acc=1|
LOCATION + EVENT
Example
SERVER_DOMAIN/api/api_loc.php?imei=123456789012345&dt=2016-01-01
00:00:00&lat=54.000000&lng=25.000000&altitude=100&angle=45&speed=60&loc_valid=1¶ms=batp=100|acc=1|&event=sos