...
No Format |
---|
https://yourdomain.com/installpath/index.php/api/users/get.xmljson?user_id=1 |
In the above example, yourdomain.com is your domain and installpath is the path to the Blesta installation. If you have enabled pretty URLs in Blesta the path omit the index.php portion. users is the model to request, get is the method, and xml is the format.
...
The API supports XML, JSON, and PHP serialization formats. By default XML JSON formatting is used. So if there is an error detecting the format of the request (due to a bad URL, for example) the error response will be returned in XML JSON format.
Errors
Timestamps
The API returns all timestamps in UTC time using the following ISO 8601 format:
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?php // The URL to the API $api_url = "https://yourdomain.com/installpath/index.php/api/"; // API credentials $api_username = "username"; $api_key = "key"; // The Model to request $model = "users"; // The method to request $method = "get"; // The response format $format = "xmljson"; // All parameters to send $params = array( 'user_id'=>1 ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api_url . $model . "/" . $method . "." . $format . "?" . http_build_query($params)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $api_username . ":" . $api_key); $result = curl_exec($ch); echo $result; ?> |
...
No Format |
---|
php index.php /api/users/get.xmljson -u USER -k KEY -m GET -p "user_id=1" |
...