ezeio2:apiref:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
ezeio2:apiref:start [2021-11-15 21:34] andrehezeio2:apiref:start [2022-08-11 17:17] (current) – [Version 1 API] andreh
Line 27: Line 27:
 === Available API functions === === Available API functions ===
 {{indexmenu>ezeio2:apiref}} {{indexmenu>ezeio2:apiref}}
 +
 +=== API fair use ===
 +The API functionality is a shared resource, and as such requires 'good behavior' from those that use it. Access to the API features are logged and monitored by eze System, and if we detect inefficient or for any reason concerning usage we will contact the user and/or suspend the IP/access key until the problem is resolved.
 +
 +The API also implements flood control counters to limit excessive calls as follows;
 +  * Per 60 seconds : 100 API calls per key
 +  * Per 24 hours : 50000 API calls per key
 +If these limits are exceeded, an error is returned. The counters are automatically reset at the end of the interval.
  
 === Example code === === Example code ===
 This example shows how to call the "syslog" API endpoint using PHP. This example shows how to call the "syslog" API endpoint using PHP.
  
-<code php>+<code php ezeioAPIexample.php>
 <?php <?php
     define("APIURI", "https://api.eze.io/v1/syslog");     define("APIURI", "https://api.eze.io/v1/syslog");
Line 48: Line 56:
     );     );
    
-    // Request a websocket key and metadata using cURL+    // Set up cURL
     $ch = curl_init();     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, APIURI."/".implode("/", $params));     curl_setopt($ch, CURLOPT_URL, APIURI."/".implode("/", $params));
Line 72: Line 80:
     // Show what we received     // Show what we received
     print_r($json);     print_r($json);
 +</code>
 +
 +Below is a minimal example fetching current status using Python
 +
 +<code python ezeioAPIexample.py>
 +import requests
 +from requests.auth import HTTPDigestAuth
 +from pprint import pprint # Just used to format the output
 +
 +# API credentials from eze.io -> Groups Settings -> Manage API Keys
 +apikeyid = '00000'
 +apikey = '12345abcde12345abcde12345abcdeff'
 +
 +# API endpoint and request - see doc.eze.io
 +apiurl = 'https://api.eze.io/v1/status/ABC000'
 +
 +# Send request
 +r = requests.get(apiurl, auth=HTTPDigestAuth(apikeyid, apikey))
 +
 +# Convert response to a dictionary
 +data = r.json()
 +
 +# Dump whole dictionary to screen
 +pprint(data)
 +
 +# Print the value of field 1
 +print(data['fields']['1']['value'])
 </code> </code>
  • ezeio2/apiref/start.1637012062.txt.gz
  • Last modified: 2021-11-15 21:34
  • by andreh