Create Request
To interact with system's API you'll need both api_key and company_id, both are mandatory in all cases.
Get API Key
To create an API KEY please log on the Client web interface (http://{domain}/client) first with your given username and password.
Go to Settings → User
Double click the record line or click icon to open the detail view window.
If there no existing API Key you'll need to click the 'Generate a new key' button to create one.
Once the API Key is generated, you need to add api_key HTTP Header with according value in your RESTFul requests.
Get company_id
Visit the URL http://{domain}/client/public/company-list to get a list of companies , alternatively you can use your preferred RESTFul tools to get the list.
(In the example below we are using PostMan REST Client)
Create Request (GET)
You are all set to request to our server now.
For example, to lease all Client Users under current account:
curl -H "api_key: fd7ee0f2f86b41c0b00dd0f5c2281a61" -H "company_id: 1" http://{domain}/client/Client-User
You can also use PostMan to request for pretty response print out:
Create Request (POST)
You can submit your POST request either in HTTP Form format or JSON format.
To send request in Form format you need to add 'Content-Type:application/x-www-form-urlencoded' in your HTTP Header.
To send request in JSON format you need to add 'Content-Type:application/json' in your HTTP Header.
Form format:
JSON Format
Please note the in the above example we used an existed username so the server prompted error message, this is to demonstrate how server would response errors:
- A 500 HTTP status code would be returned
- Server will return "success":false in the returned JSON
- A detailed explanation message is returned.