API Usage :

Using the API

API to access graph ressources : listing, deleting, modifiying, adding, get a svg graph.
Some of the actions are not yet implemented.

API request :
 GET variables : api_user (=key), api_action, api_output, {id}
 {POST variables : legend, data...) When adding a data to an existing graph

Action list available ($_GET['api_action'])

graph_publiclist : Get a list of the public graphs
graph_bykey : Get a svg graph by a specific key if public or part of yours
graph_byid : Get a svg graph by a specific id if public or part of yours
graph_listbyuser : Get your graphs list
graph_delete : Delete a graph by a specifc id ($_GET)
graph_copyfromid : Not yet implemented
graph_add : Not yet implemented
graph_adddata : Not yet implemented
graph_update : Not yet implemented

Output formats available ($_GET['api_output'])

json
serialize

Call examples

http://<url_api>?api.php?api_user=XXX&api_action=graph_publiclist&api_output=json
or
http://<url_api>?api.php?api_user=XXX&api_action=graph_byid&api_output=json&id=17

returns :
<pre>
<?php
  $result
['code'];  // code error, 0 if not set
  
$result['message']; // message error if set
  
$result['output']; // The result if all is OK !
?>
</pre>

PHP examples

Example with action : graph_publiclist
Example with action : graph_bykey
Example with action : graph_byid
Example with action : graph_listbyuser
Example with action : graph_delete

Output error codes ($result['code']) and messages ($result['message'])

[0] => All is OK
[-1] => Too many requests. Dropping request
[-2] => Error log file
[-3] => Action unauthorized
[-4] => Authentification failed
[-5] => Output format unrecognized