API calls

Follow

API calls are HTTP calls

Every API call is regular HTTP call, what consists of API address, groups and query name and parameters. Let's check following example:

https://app.ecofleet.com/seeme/Api/Reports/getReportConf?id=booking&key=apidemo-NJ8V7PENgkau5FYH
  • https://app.ecofleet.com/seeme/Api/ is API address
  • Reports/ is API group. This is like subfolder, what contains subset of commands, or more groups.
  • getReportConf is API call under Reports group
  • id=booking, key=apidemo-NJ8V7PENgkau5FYH are GET parameters for HTTP call

You have to add always key parameter, what contains value of your API key. All other parameters vary from query to query. Also, you have to escape your parameters correctly to get them working properly.

Second parameter, what you may use for every call, is json. If it exists, system outputs call in JSON format instead of XML.

Response

Default, every API response is in XML format. Here is one example:

<?xml version="1.0" encoding="utf-8" ?>
<nodes>
   
<status>0</status>
   
<response>
       
<node key="0">
           
<id>NewDayReport</id>
           
<title>Day report</title>
       
</node>
    </response>
</nodes>

Status shows, is that query successful or not. All non-zero values indicate for error.

response contains useful content for that query.

Another example:

<?xml version="1.0" encoding="utf-8" ?>
<nodes>
   
<status>7</status>
   
<response>
   
</response>
   
<errormessage>No permissions</errormessage>
</nodes>

This example shows, how error message looks like. Status is nonzero (7) and there is element errormessage, what contains details about problem. In our guide, there is troubleshooting section on article of every API call, what describes most error messages, what one may meet.

JSON queries

If you add json parameter to your API call, responses are created as JSON values. For example, two last messages in JSON would look like:

Api/Reports/listReports?id=booking&key=apidemo&json
{"status":0,
"response":[{
"id":"booking",
"title":"Booking report"
}]}

And error message:

{"status":7,
"response":null,
"errormessage":"No permissions"}

This manual uses API key apidemo-NJ8V7PENgkau5FYH, what is used in some example calls. Feel free to use it for testing out demo API calls. This API user is isolated from other accounts, so it does not cause any harm to system.

Was this article helpful?
0 out of 0 found this helpful