API Key
Manage the API keys for your account on the Programmer API settings page. Here you can enable or disable API access, view active keys, and create new ones. Individual key permissions can be customized to allow a key to read, create, edit, or delete information in the CRM.
Note that we encrypt the keys in storage, so you will not be able to retrieve the key after you create it. If you have forgotten a key, we recommend creating a new one and deleting the one you forgot.
It's also worth mentioning that an admin can turn off API key access for your account. If this happens, you won't be able to call the API, and your existing API keys will be deactivated. If your access to the API is restored later, you'll need to create a new key.
OAuth
In order to use OAuth, you must be registered as an integration partner with LACRM. One you've done that and we've given you your OAuth credentials, you can follow these instructions to access our API via OAuth.
Make API calls by sending a POST request to https://api.lessannoyingcrm.com/v2/
.
Your request should include an Authorization header containing only your API key.
The body of your request should be JSON, formatted as follows:
{
"Function": "GetContact",
"Parameters": {
"ContactId": "1234567890123456789012345678901"
}
}
Here is a full example using PHP and cURL. It calls GetUser, which takes no parameters and should always return your user information.
<?php
function CallLacrmApi(string $Function, array $Parameters=array()) {
$CurlHandle = curl_init("https://api.lessannoyingcrm.com/v2/");
$Headers = array(
"Content-Type: application/json",
"Authorization: YOUR_API_KEY_HERE"
);
$Body = array(
"Function" => $Function,
"Parameters" => $Parameters
);
curl_setopt($CurlHandle, CURLOPT_POSTFIELDS, json_encode($Body));
curl_setopt($CurlHandle, CURLOPT_HTTPHEADER, $Headers);
curl_setopt($CurlHandle, CURLOPT_RETURNTRANSFER, true);
$CurlResult = curl_exec($CurlHandle);
$ReturnValue = false;
if (curl_errno($CurlHandle)) {
error_log(curl_error($CurlHandle));
} else {
$ResultObject = json_decode($CurlResult, true);
$HttpCode = curl_getinfo($CurlHandle, CURLINFO_HTTP_CODE);
if ($HttpCode === 400) {
error_log("Error $ResultObject[ErrorCode]: $ResultObject[ErrorDescription]");
} else {
$ReturnValue = $ResultObject;
}
}
curl_close($CurlHandle);
return $ReturnValue;
}
print_r(CallLacrmApi("GetUser"));
?>
There are more code examples on the Tutorials page.