Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The API supports hundreds of requests, and many more through API extensions, so we can't document them all here. Instead, check out the source code documentation. All public model methods are callable through the API. To find documentation on a particular request pull up the related model and method from the source code documentation.

Examples

Below are a few basic examples to get you started.

API RequestDescriptionPHPCURL
encryption/systemEncryptEncrypts the given value using 256-bit AES in CBC mode using a SHA-256 HMAC hash as the key, based on the system configured setting in Blesta.system_key
Expand
titleShow Source
<?php
require_once "blesta_api.php";
 
$user = "username";
$key = "key";
$url = "https://yourdomain.com/installpath/api/";
 
$api = new BlestaApi($url, $user, $key);
 
$response = $api->post("encryption", "systemEncrypt", array('value' => "my text"));
 
print_r($response->response());
print_r($response->errors());
?>
Expand
titleShow Source
curl https://yourdomain.com/installpath/api/encryption/systemEncrypt.json -u username:key -d 'value=my text'

How to Read the Source Docs

The source code documentation contains documentation on everything in Blesta, but the API only supports calling Model methods. You can find all core model methods under blesta > app > models, however plugin model methods are also callable through the API.