Get Started Login Sign Up Contact

Info API

LiveTrack24 - Info API[en]

LiveTrack24

 

What is info API

The InfoAPI allows 3rd party applications and websites to get information about live tracks, like for example the position and height of a specific username thus allowing 3rd parties to construct usable and functional views on the livetrack database.

Restrictions

An API key and API secret are required to use the API. Currently i will only give these to developers of mobile applications to add extra value to their applications by querying useful info from the livetrack24.com

How to use

the url of the API is

http://www.livetrack24.com/api.php?....

and the parameters are

a=<APIKEY>
c=<special CRC of the unencoded request text>
m=<encoded request text>

We will see later what should be the contents of m variable, now we must

  1. compute the special CRC of the unencoded text
  2. encode the request text

Compute the special CRC of the unencoded text

Here is the php code to compute the CRC

function crc_16($data,$key) {
  $crc = 0xFFFF;
  for ($i = 0; $i < strlen($data); $i++)
  {
    $x = ( ($crc >> 8 ) ^ ( ord( $data [ $i ] ) + $key [ $i ] )  ) & 0xFF;
    $x ^= $x >> 4;
    $crc = ( ( $crc << 8 ) ^ ( $x << 12 ) ^ ( $x << 5 ) ^ $x ) & 0xFFFF;
  }
  return dechex($crc);
}
  • $data is the clear text
  • $key is your API secret (not the API key)

What you get from this function is a 4 char string that represents a 32 bit integer in hex format (ie 4E21 )

Encode the request text

Here is the function to encode your request text

function encryptWithApiKey($str,$key) {
	
	$final="";
	for($i=0; $i< strlen($str) ; $i++ ) {
		$charcode= ord( $str[$i] );
		
		$keypos= $i % strlen($key);
		if ( $keypos > 0 ) 
			$sign=( $key[ $keypos - 1 ] % 2 ) ? 1 : -1;  
                       // if the previous digit from the  key is odd, 1 , else -1
		else 
			$sign=1;
			
		$encryptedCode= $charcode + $key[ $keypos ] * $sign ;	
		$encryptedHex=dechex( $encryptedCode );
		
		$final.= $encryptedHex;
	} 
	return $final;
}
  • $str is the clear request text
  • $key is your API secret (not the API key)

What you get from this function is a char string with hex values, you must pass this as &m=.... to the API url

Example

Assume you have

  • API key="R35G7852"
  • API secret="3467257245748253452345214"
  • Request text="7;1;0" -> this is a simple ping request to the server, it returns the server IP

What you should compute is

  • crc should be 9ec1
  • the encrypted message should be 3a3f2b3432
  • so the api url is
http://www.livetrack24.com/api.php?a=R35G7852&c=9ec1&m=3a3f2b3432

Using un-encoded requests for testing

For the period of testing, you can request an API key with unencoded access, you can use this to send un-encoded requests to the server with the following format:

Example

to use the previous exmaple

http://www.livetrack24.com/api.php?a=R35G7852&cm=7;1;0

to get the 30 most near tracks around lat/lon 40.2,23.1 in a radious of 100 km in the last 20000000 secs

http://www.livetrack24.com/api.php?a=R35G7852&cm=1;3;255;40.2;23.1;100;0;20000000;30

Operations

Get nearby tracks around a given point

Request text

1;<return type (only 3->json is supported>;<detail level 0-255 (not in effect currently, )>;<latitude of center in decimal format>;<longtitude of center in decimal format>;<search radius in km>;<activity type: 0->all, 1->3d (ie flights), 2->2D (ie run, bike)>;<return only tracks in the last X secs>;<return only latest X results, sorted by last fix>

Sample Request text

1;3;255;40.2;23.1;100;0;259200;30

<1=Get nearby tracks>;<3=return as json>;<255=max detail>;<latitude of center=40.2>;<longtitude of center=23.1>;<search in radius of 100 km>;<search in 2D and 3D activities>;<return only tracks in the last 259200 secs - 3 days>;<return only latest 30 results, sorted by last fix>

Returns

distance: distance (in m) of the last point of this track to the provided lat/lon
bearing: bearing (0-360) of the last point of this track to the provided lat/lon
username: the username of this track
tm: timestamp of last fix we got (in UTC)
trackID: the ID of the track, can be used to obtain more info for this track
lat: latitude in decimal format of the last fix
lon: langitude in decimal format of the last fix
alt: altidute (in m) of the last fix
cog: Course over ground (0-360) of the last fix
sog: Speed over ground (in km/h)  of the last fix

Get takeoffs around given point

Request text

1;<return type (0,1,2 currently supported)>;<detail level 0-255 (not in effect currently)>;<latitude of center in decimal format>;<longtitude of center in decimal format>;<search radius in km>;<return only X results>

Sample Request text

3;1;255;40.2;23.1;100;30

Get position of username(s) or userID(s)

Request text

2;2:<return type (0,1,2 currently supported)>;<detail level 0-255>;username1,username2...;userid1,userid2...;lat;lon;radious for nearby waypoints;limit for each category of waypoints

if you provide a set of lat/lon the output will also include the distance and bearing of the user in relation to the provided lat/lon

Returns

  • to be completed-