Description
Do authentication on API. Use API key instead.
Params
Name | Type | Description |
---|---|---|
username | string | Your username. |
password | string | Your password. |
Returned data
Type: string
Description: Returns the session id. It can be used to access other functions.
Json sample code
<?php $curl = curl_init('https://your_address/ccm/admin/api/version/2/&type=json'); $postData = array( 'function' => 'doAuthentication', 'username' => 'my_username', 'password' => 'my_password', ); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postData)); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $json = curl_exec($curl); if ($json === false) { die('Request failed with error: '. curl_error($curl)); } $result = json_decode($json); if ($result->status == 0) { die('Bad status returned. Error: '. $result->error); } var_dump($result->data);
Result of API call
string(40) "2a346220242b9c8949cdc018b12345d0d9ff936a"