update.php

Update or insert (if it does not exist) an entry into the database

Arguments

apikey (necessary)
API key: you can request a key by sending an email to contact@weglide.org
cle (necessary)
public key, generated by the client. This is a (random) string of less than 20 caracters.
pass (necessary)
Private key, generated by the client. This is a (random) string of less than 20 caracters.
nick (necessary)
Nickname. This is a string of less than 20 caracters.
lat (necessary)
Latitude (float number)
lng (necessary)
Longitude (float number)
alt (necessary)
Altitude (float number)
speed (necessary)
Speed (float number)
action (necessary)
Action type:

100: SOS, in case of emergency

0: on ground

1: paragliding

2: hanggliding

3: gliding

4: on a balloon

5: kite

6: skydiving

7: plane

group
Group name, nickname used to quickly find members of the same group, like flight schools, friends, family...

Query example:http://www.weglide.org/api/update.php?pass=toto&cle='key'&lat=9&lng=10&alt=100&speed=3&action=1&nick=toto

Android example:

		ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
		nameValuePairs.add(new BasicNameValuePair("cle",key));
		nameValuePairs.add(new BasicNameValuePair("pass",private_key));
		nameValuePairs.add(new BasicNameValuePair("alt",""+altitude));
		nameValuePairs.add(new BasicNameValuePair("lng",""+longitude));
		nameValuePairs.add(new BasicNameValuePair("lat",""+latitude));
		nameValuePairs.add(new BasicNameValuePair("speed",""+speed));
		nameValuePairs.add(new BasicNameValuePair("nick",""+nickname));
		nameValuePairs.add(new BasicNameValuePair("action",""+action));

		// http post
		try {
			HttpClient httpclient = new DefaultHttpClient();
			HttpPost httppost = new HttpPost(
					"http://www.weglide.org/api/update.php");
			httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
			HttpResponse response = httpclient.execute(httppost);
			HttpEntity entity = response.getEntity();
			is = entity.getContent();
			
		} catch (Exception e) {
		...
		}

Answers (error codes):

-1
the entry defined by 'cle' does not exist in the database
-2
the parameters could not be validated
-3
too many similar 'cle' exist
-5
The generated sql query is invalid
1
The entry has been inserted
2
The entry has been updated