Guide to API VMmanager 6
Access the API by the URL https://domain.com/service/api_version/function/.
domain.com — public IP address or the domain of the server with VMmanager 6.
service — internal service for processing requests: auth or vm.
api_version — current version API: v3.
function — function to be executed in VMmanager 6.
VMmanager 6 supports GET, POST, and DELETE.
To send parameters for a POST-request, specify them in the request body in the JSON format.
A response to API-requests is sent in the form of JSON-objects, e.g.:
How to process code 503
If VMmanager 6 is not active for a long time it can be suspended. The API-requests will be terminated with code 503. Repeat the requests until you receive another code:
Filters in requests
VMmanager 6 supports two GET-requests:
the information about a certain element by its ID — the response will contain the information about the specified element. It won't contain the information about associated elements such as IP address, cluster, and VM disk. E.g.:
a full list of elements of a certain type — the response will contain a full list of all elements of the specified type. The response will also contain information about all items. E.g.:
We recommend requesting a full list of elements and applying filters to it. This allows receiving information about all associated items.
- WHERE — similar to the expression WHERE in SQL. It supports the processing of logical operators AND, OR, NOT. Comparison parameters:
- EQ — equal;
- NE — not equal;
- GT — larger;
- GE — larger than or equal to;
- LT — less;
- LE — less than or equal to;
- CP — search for values by the specified mask. Similar to the operator LIKE in SQL;
- ORDERBY — sort by the specified parameter. If the sorting is not specified, the list will be sorted in ascending order by ID. Possible order:
- ASC — in ascending order;
- DESC — in descending order;
- LIMIT — output the range of filtered elements. Enter two comma-separated digits as values. The numbering starts with 0.
- put ? before the first filter;
- use = to specify the filter values and parameters;
- put digital and text values in single quotes;
- separate parameters, values, and logical operations of the filter with +;
- put conditions of the filter WHERE into brackets. To group conditions, use the logical operations AND, OR and NOT;
- group several filters with &.
Examples of requests with filters
Authentication is required for API-requests in VMmanager 6.
Login and password authentication
To receive a session number, send the POST-request to a URL like https://domain.com/auth/v3/auth.
Handle the response. It can contain error messages or JSON like:
Use the session number that you have received in the heading of the HTTP request. E.g.:
In the case of error you will receive the following message:
VMmanager 6 supports throughout user authentication with an admin login and password. Eg. it can be used to redirect authorized users from BILLmanager to VMmanаger 6.
How it works:
- Log in to VMmanager 6 as Admin.
- To generate an authentication key, send the POST-request to the URL like https://domain.com/auth/v3/user/user_email/key. The response will contain a JSON-object with the key field.
To receive the session number, send the POST-request to the URL like https://domain.com/auth/v3/auth_by_key. In the request body, specify the key that you have received on step 2.