Used to interact with the site. Available methods: user registration, adding, retrieving, update and delete records.

Where and how to use the API

  1. When client registering  on your site, you need also create an account for it on the Rukovoditel.
  2. When client creating order on your site, you need part of the data insert to Rukovoditel for the reporting.
  3. You want to display on your site some of the public data from a report.
  4. Integration with third-party services. For example, you have an address database, and you want to display them on the map in your own format. Using the API, you can select data from the database and display it using a third-party service. This can be done in real time.

To start using the API, you need to allow access to the API and generate the key. You can do this on the page: Extension - Tools - API.

Next, to call the API methods, you will need the user's username and password. It is recommended to create a separate user to work with the API and configure access only to those Entities that will be used through the API.

API methods can be called directly via PHP or via JSON.

Please note: the following examples are not intended for use on your application. Each application created in the Rukovoditel has its own unique ID for the Fields and Entities that must be used in the API code.

Example 1 (PHP):

$params = array(
  'key' => 'KUhUvp8sGZv1vIlQATEQXr4HJT4SsWEjd8LWGSN6',  
  'username' => 'admin',
  'password' => 'admin',
  'action' => 'select',
  'entity_id' =>21
);
 						                                    
$ch = curl_init('http://localhost/rukovoditel/product_3.6/api/rest.php');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);			
$result = curl_exec($ch);
curl_close($ch);

if($result)
{
  $result = json_decode($result,true);
}

Example 2 (JSON):

$json_string = '
	{
    "key": "KUhUvp8sGZv1vIlQATEQXr4HJT4SsWEjd8LWGSN6",
    "username": "admin",
    "password": "admin",
    "action": "select",
    "entity_id": 21
	}
';
 						                                    
$ch = curl_init('http://localhost/rukovoditel/product_3.6/api/rest.php');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER,array("Content-type: application/json"));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_string);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);			
$result = curl_exec($ch);
curl_close($ch);


if($result)
{
  $result = json_decode($result,true);
}

On success, the API returns status: success

Array
(
    [status] => success
    [data] => []
)

In case of an error, it returns status: error and the error text:

Array
(
    [status] => error
    [error_code] => 
    [error_message] => field_429 not exist in entity 34
)