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);

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