Versions Compared

Key

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

The Common CRM API exposes the members resource of the Link Mobility CRM software, in a RESTful API. Members can be pushed to Link CRM from other software, or it can be pulled from CRM into other software. 

Table of Contents

Base URL and swagger

https://crm-api.linkmobility.com/api/sdk/

http://crm-api.linkmobility.com/swagger/ui/index#!/Sdk

Autentication

The API uses HMAC-SHA256 authentication. The request header hmac contains the partnerId, a message signature, the nonce and the timestamp, separated by :. The hmac signature is generated by hashing partnerId, http verb, uri, timestamp, nonce, and an MD5 of the content, if there is any, with SHA256. 

...

Code Block
<?php
 
$partner_id = '<your partner id>';    // from LINK Mobility
$secret_key = '<your secret key>';    // from LINK Mobility
$secret_key = base64_decode($secret_key);
 
# EXAMPLE generating HMAC for GET request to api/sdk/members/<groupId><memberId>
 
$request_method = strtoupper("GET");
$url = 'https://crm-api.linkmobility.com/api/sdk/members/771/08F8DCB2-21CA-4661-B6DD-3F553C5449FD';
$url = strtolower($url);
$request_content = '';
 
$auth_header = getAuthHeader($partner_id, $secret_key, $request_method, $url, $request_content);
echo $auth_header;  // display the Authorization: header to be included in the request
 
 
function getAuthHeader($partner_id, $secret_key, $request_method, $url, $request_content) {
    # generate Authorization Header
    $requestUri = urlencode($url);
    $requestTimeStamp = time(); // current UNIX timestamp
    $nonce = uniqid(); // string
    if ( !empty($request_content) ) {
        $requestContentMd5Hash = md5($request_content, true); /* raw binary format with length of 16 */
    } else {
        $requestContentMd5Hash = $request_content;
    }
    $request_content = base64_encode($requestContentMd5Hash);
    $signatureRawData = ($partner_id . $request_method . $requestUri . $requestTimeStamp . $nonce . $request_content );
    $utf8_data = utf8_encode($signatureRawData);
    $hmac_before_base64 = hash_hmac ( 'sha256', $utf8_data , $secret_key, true ); // not raw digital output
    $hmac_base64_encoded = base64_encode ( $hmac_before_base64);
    $hmac_substringed = mb_substr ( $hmac_base64_encoded, 0, 10, 'UTF-8' );
    $auth_header = "Authorization: hmac $partner_id:$hmac_substringed:$nonce:$requestTimeStamp";
    return $auth_header;
}
?>

Base URL

...

Formats

The response from GET requests will by default be formatted as XML. If you prefer to use JSON, you can append the following to the URI: ?$format=json. 

...