Trust Profile API

We have to Widgets available through JavaScript, a small and a large.

JavaScript


// Displays the small Trust Profile Widget
// Parameters:
// UserID: the users deemly id
// selector: the id or id of the div that should hold the widget, ex "#deemly-container" or ".deemly-widget"
deemly.renderScoreWidget({
    userId: 'DEEMLY-USER-ID',
    selector: '#small-widget'
});
// Displays the large Trust Profile Widget
// Parameters:
// UserID: the users deemly id
// selector: the id or id of the div that should hold the widget, ex "#deemly-container" or ".deemly-widget"
// showSocialMediaIcons: true/false. Whether to show the users sociral verifications in the widget
deemly.renderLargeScoreWidget({
    userId: 'DEEMLY-USER-ID',
    selector: '#large-widget',
    showPlatforms : true,
    showSocialMediaIcons : true
});

To retrieve the data for building the Trust Profile Widget you call the endpoint as such

C#


//use HttpClient to make the API calls
using (var httpclient = new HttpClient())
{
    string applicationId = "Your sites APP key";
    string secredKey = "Your sites Secret key";
    string userId = "The deemly user id";
    var mng = new SecurityManager(_siteService);
    var ts = DateTime.UtcNow - new DateTime(1970, 1, 1);
    long ticks = (long)(ts.TotalMilliseconds * 10000) + 621355968000000000;
    // We'ere still in beta
    string userAgent = ".NET Test 0.1";
    var token = mng.GenerateToken(applicationId, secredKey, userAgent, ticks);
    httpclient.DefaultRequestHeaders.Accept.Clear();
    httpclient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("amx", token);
    httpclient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
    httpclient.DefaultRequestHeaders.Add("User-Agent", ".NET Test 0.1");
    var response = await httpclient
    .GetAsync("https://portal.deemly.co/api/deemly-score?userId="+userId)
    .ConfigureAwait(false);
    var responseContent = await response.Content.ReadAsStringAsync();
    // Return the deemly user info in json
    return responseContent;
}

PHP


$app_key    = 'Your sites APP key';
$secret_key = 'Your sites secret key';
$user_id    = 'The deemly user id';
// Our salt
$salt = 'YOUR_APP_SALT';
$security = new SecurityManager($app_key, $salt, $secret_key);
// We'ere still in beta
$userAgent = 'PHP Test 0.1';
// Yir, ticks in PHP...
$ts = microtime(true);
$ticks = intval($ts) * 10000000 + 621355968000000000;
$message = $security->GenerateToken($app_key, $secret_key, $userAgent, $ticks);
// Create a cURL handle
$ch = curl_init();
$headers = array(
    'Accept: application/json',
    'content-Type: application/json',
    'Authorization: amx ' . $message
);
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt( $ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);
// Yes, we're also in beta here
curl_setopt( $ch, CURLOPT_URL, "https://portal.deemly.co/api/api/deemly-score?userId=".$user_id);
// Return the deemly user info in json
return curl_exec( $ch);
// Close handle
curl_close($ch);

Python


def getdeemlyuserdata(userId):
    appKey = "YOUR APP KEY"
    secretKey = "YOUR SECRET KEY"
    
    # Our salt
    salt = "rz8LuOtFBXphj9WQfvFh"
    security = SecurityManager(appKey, salt, secretKey)
    
    # We"ere still in beta
    userAgent = "PHP"
    
    ts = time.time()
    
    ticks = int(ts) * 10000000 + 621355968000000000
    
    message = security.GenerateToken(appKey, secretKey, userAgent, ticks)
    
    headers = {
        "Accept": "application/json",
        "Content-Type": "application/json",
        "User-Agent": userAgent,
        "Authorization": "amx %s" % message
    }
    
    url = "https://portal.deemly.co/api/deemly-score?userId=%s" % userId
    response = requests.get(url, headers=headers, verify=False)
    
    return response


if __name__ == "__main__":
    print(getdeemlyuserdata('DEEMLY USER ID').content)

Ruby on Rails


require 'securerandom'
require 'openssl'
require 'base64'
require 'date'
require 'net/http'
class App

  def self.initialize(user_id)
    app_key = "YOUR APP KEY"
    secret_key = "YOUR SECRET KEY"
    user_agent = ".NET Test 0.1"
    
    manager = SecurityManager.new
    ticks = (Time.now.to_f * 10000000).to_i + 621355968000000000
        
    token = manager.generateToken(app_key, secret_key, user_agent, ticks)
    uri = URI.parse('https://portal.deemly.co/api/deemly-score?userId=' + user_id)
	  http = Net::HTTP.new(uri.host, uri.port)
	  http.use_ssl = true
    request = Net::HTTP::Get.new(uri.request_uri, {'Authorization' => 'amx ' + token.gsub(/\n/,''), 'Accept' => 'application/json', 'content-Type' => 'application/json', 'User-Agent' => user_agent})
    
    response = http.request(request)

    puts response.read_body
  end
end

If the call is succesfull you will get data back in JSON format.


stdClass Object
(
    [$id] => 1
    [isSuccess] => 1
    [message] => 
    [responseData] => stdClass Object
        (
            [$id] => 2
            [scoreViewModel] => stdClass Object
                (
                    [$id] => 'string'
                    [score] => 'string'
                    [numberOfSites] => 'string'
                    [totalNumberOfRatings] => 'string'
                )

            [name] => 'string'
            [profilePictureUrl] => 'string'
            [profilePageUrl] => 'string'
            [coverPictureUrl] => 'string'
            [siteAvgStarRatings] => Array
                (
                    [0] => stdClass Object
                        (
                            [$id] => 'string'
                            [platform] => 'string'
                            [starNumber] => 'string'
                        )
                )

            [verifiedWith] => Array
                (
                'string'
                )

        )

)

Let's talk

Request free demo