REST API Specification – Authentication

Authentication

Before you can use any API functions, you need to authenticate a user.

  • Description: Authenticate user.
  • URL structure: https://your_subdomain.crm.me/crm/app/index.php/zurmo/api/login
  • Method: POST
  • HTTP header parametres:
    Accept: application/json
    ZURMO_API_REQUEST_TYPE: REST
    ZURMO_AUTH_USERNAME: %username%
    ZURMO_AUTH_PASSWORD: %password%
  • Parameters: None
  • PHP example:
public function login($username, $password)
{
    $headers = array(
        'Accept: application/json',
        'ZURMO_AUTH_USERNAME: ' . $username,
        'ZURMO_AUTH_PASSWORD: ' . $password,
        'ZURMO_API_REQUEST_TYPE: REST',
    );
    $response = ApiRestHelper::createApiCall('https://your_subdomain.crm.me/crm/app/index.php/zurmo/api/login', 'POST', $headers);
    $response = json_decode($response, true);

    if ($response['status'] == 'SUCCESS')
    {
        return $response['data'];
    }
    else
    {
        return false;
    }
}
  • Return:
    Data contains array of sessionId and token elements.
  • Response example:
{
    "status":"SUCCESS",
    "data":{
        "sessionId":"9g4hl42qq55kuoblje038fmef4",
        "token":"f357a171e8cba6e8aad92a971922a5b3"
    },
   "message":null,
   "errors":null
}
Have more questions? Submit a request

Comments

Powered by Zendesk