Authentication

Basic steps to authenticate with the API

Grant API rights

In order to authenticate, a user must be granted the right to access the API. This is achieved on Edit User form.

Grant API rights

Obtain API Secret

Once granted API rights, the user's unique API secret will be visible on his profile.

Obtain API Secret

Submitting a Request

Each request requires two pieces of information:

  1. An authorization hash (parameter: "auth_hash")
  2. A username (parameter: "auth_username")

To create the authorization hash, concatenate the url of your request with your secret (obtained above) and hash the result.

Sample: C# with RestSharp

var client = new RestSharp.RestClient();
var url = baseUrl + "/Api/Organization/List"; // base url is the fully qualified application url. E.g. "https://www.datarg.net"
var hash = new System.Security.Cryptography.SHA512Managed();
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(url.ToLower() + myApiSecret.ToLower()); // url and secret must be lower case
byte[] hashBytes = hash.ComputeHash(bytes);
string hashText = Convert.ToBase64String(hashBytes);
var request = new RestSharp.RestRequest(url, RestSharp.Method.POST);
request.AddParameter("auth_hash", hashText);
request.AddParameter("auth_userName", myUsername);
// add other parameters to the request
var response = client.Execute(request);

Sample: PHP

$url = $baseUrl . "/Api/Organization/List"; 
$combined = strtolower($url) . strtolower($myApiSecret);
$hashedValue = hash("sha512", $combined, true);
echo $url . "\n";
echo $key . "\n";
echo $combined . "\n";
echo base64_encode($hashedValue);