Versions Compared

Key

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

...

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
Code Block
languagephp
linenumberstrue
<?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'
encryption/systemDecryptDecrypts the given value using 256-bit AES in CBC mode using SHA-256 HMAC hash as the key, based on the system configured setting in Blesta.system_key
Expand
titleShow Source
Code Block
languagephp
linenumberstrue
<?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", "systemDecrypt", array('value' => "b2J2aW91c2x5IG5vdCByZWFsbHkgZW5jcnlwdGVk"));
 
print_r($response->response());
print_r($response->errors());
?>

Expand
titleShow Source
curl https://yourdomain.com/installpath/api/encryption/systemDecrypt.json -u username:key -d 'value=b2J2aW91c2x5IG5vdCByZWFsbHkgZW5jcnlwdGVk'
invoices/addCreates a new invoice using the given data
Expand
titleShow Source
Code Block
languagephp
linenumberstrue
<?php
require_once "blesta_api.php";
 
$user = "username";
$key = "key";
$url = "https://yourdomain.com/installpath/api/";
 
$api = new BlestaApi($url, $user, $key);

$data = array(
	'vars' => array(
		'client_id' => 1,
		'date_billed' => date("c"),
		'date_due' => date("c"),
		'currency' => "USD",
		'lines' => array(
			array(
				'description' => "Line item #1",
				'amount' => "5.99"
			),
			array(
				'description' => "Line item #2",
				'amount' => "3.75",
				'qty' => 2
			)
		),
		'delivery' => array("email")
	)
);
$response = $api->post("invoices", "add", $data);
 
print_r($response->response());
print_r($response->errors());
?>

Expand
titleShow Source
curl https://yourdomain.com/installpath/api/invoices/add.json -u username:key 
-d 'vars[client_id]=1'
-d 'vars[date_billed]=2013-11-20T16:43:00-07:00'
-d 'vars[date_due]=2013-11-20T16:43:00-07:00'
-d 'vars[currency]=USD'
-d 'vars[lines][0][description]=Line item #1'
-d 'vars[lines][0][amount]=5.99'
-d 'vars[lines][1][description]=Line item #2'
-d 'vars[lines][1][amount]=3.75'
-d 'vars[lines][1][qty]=2'
-d 'vars[delivery][0]=email'

How to Read the Source Docs

...