NEXT SDK CRM Public Documentation
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.
Base URL
https://crm-api.linkmobility.com/api/sdk/
Connect thru SDK (optional)
If you have a .Net application for your business, you can leverage the SDK experience using the nuget command below. SDK will handle the authentication part out of the box.
Install-Package LinkMobility.CommonCrm.Sdk -Version 1.0.0 -Source https://www.myget.org/F/linknorway/api/v3/index.json
Swagger docs
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.
Signature parts | How to generate |
---|---|
PartnerId | As provided |
HTTP Method | The HTTP Method of the request |
URI | The absolute uri of the request, lower cased, and then url encoded |
Timestamp | The number of seconds since epoch UTC |
Nonce | A UUID |
Content | If there is a payload on the request, MD5-hash it. |
All of the above parts are concatenated into one string. The UTF8 encoded bytes of the string are then hashed using HMAC-SHA256, using the provided secret key, to generate a signature of the request. This signature is then base-64 encoded.
The header is then built by concatenating the partnerId, the first 10 characters of the encoded signature, the nonce and the timestamp, separated by :.
Sample hmac header
Authorization: hmac 11263:1ObfMLHlvK:2e4603e46dfd489294af13513db02c0a:1453801859 |
Sample C# code for generating the header:
|
Sample node.js for generating hmac header
Sample python code for generating hmac header (credit: www.skylabs.no)
Sample PHP code example for generating HMAC header
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.
GET /members/{groupId}/{memberId}
Gets the member information by providing the groupId and the internal member id.
URI params
Name | Description |
---|---|
groupId | An existing Link CRM groupId (internal) |
memberId | An existing Link CRM memberId (internal) |
Sample response
GET /members?groupId={groupId}&externalId={externalId}
Query params
Name | Description |
---|---|
groupId | An existing Link CRM groupId (internal) |
externalId | An existing Link CRM member externalId |
Sample response
GET /members?groupId={groupId}&countryCode={countryCode}&msisdn={msisdn}
Lookup a member resource by MSISDN.
Query params
Name | Description |
---|---|
groupId | An existing Link CRM groupId (internal) |
countryCode | Country code of the member phone number, i.e. 47. |
msisdn | Member phone number, i.e. 99999999 |
Sample response
POST /members
Creates a new member. The payload is an XML or JSON formatted representation of the new member resource.
Data | Description |
---|---|
Msisdn | The member phone number, not including country code. E.g. 99999999 |
CountryCode | The member phone number country code, E.g. 47 |
GroupId | Link CRM groupId. |
ExternalId | Optional. Can be used to link to an Id in an external system. |
FirstName | Optional. The member's first name. |
LastName | Optional. The member's last name. |
StreetAddress | Optional. The member's street address. |
ZipCode | Optional. The member's zip code. |
City | Optional. The member's city. |
Location | Optional. The member's geolocation, specified with latitude and longitude. E.g. |
BirthDate | Optional. The member's birth date. |
Gender | The member's gender. 0 = unspecified, 1 = female, 2 = male. |
Optional. The member's email. | |
CustomProperties | Optional. In Link CRM there is an option to attach custom properties to member resources. These must be defined in Link CRM to be used in the API. |
Sample response
PUT /members/{groupId}/{memberId}
Updates an existing member.
URL params
groupId | An existing Link CRM groupId (internal) |
memberId | An existing Link CRM memberId (internal) |
The updated member resource is included in the request body, as XML or JSON. Set the appropriate content-type in the request header.
The payload will replace the existing member resource identified by that memberId.
Sample response
Error codes
Code | Result |
---|---|
401 Hmac timestamp clock-drift too high | The timestamp used to generate the hmac token is too old. |
401 Invalid HMAC | The hmac token in the Authorization header has some invalid content. |
400 Member id <id> not found | The provided memberId does not exist |
400 Group id <id> not found | The provided groupId does not exist |
Feeling lost? Click on this link! Portal page