Token

Token

DealCloud uses OAuth2 Client Credentials to generate tokens. Tokens have a 15 minutes expiry. The token endpoint returns a access token which can be used against all other endpoints. To find out how to get a token please see the examples section.

Authentication

Your Client Id and Secret are needed to generate a Token. All endpoints on the API requires a valid token. Tokens are only valid for 15 minutes any integration will need to have the ability to generate tokens and regenerate token if the process will run for more than 15 minutes.

Scopes

When generating a token you need to provide a scope. The API supports 3 scopes (data, user_management, provider_sync), these can be combined if needed. The caption below indicates which scope is needed for each functional area. For most request data is the appropriate scope needed. The scope will not provide more capability then the user account has within the platform.

ScopeDescription
user_managementThis scope is used when working with the user management APIs.
dataThis scope is used when working with the schema and data APIs. For most API requests, this is the scope needed
publishThis scope is used when working with the Publication APIs.
ri_importThis scope is used for using the Relationship Intelligence Import APIs

Limits

Requests to the token API are limited to 300 calls per minute per users in production, 60 in UAT/Sandbox.

Examples

HTTP

POST {baseUrl}/api/rest/v1/oauth/token
Content-Type: application/x-www-form-urlencoded
 
scope=data
&grant_type=client_credentials
&client_id=106
&client_secret=1356GYNU

Code Snippets

Code snippets from popular programming languages.

C#

var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Post,
    RequestUri = new Uri("https://site.dealcloud.com/api/rest/v1/oauth/token"),
    Headers =
    {
        { "user-agent", "vscode-restclient" },
    },
    Content = new FormUrlEncodedContent(new Dictionary<string, string>
    {
        { "scope", "data" },
        { "grant_type", "client_credentials" },
        { "client_id", "106" },
        { "client_secret", "1356GYNU" },
    }),
};
using (var response = await client.SendAsync(request))
{
    response.EnsureSuccessStatusCode();
    var body = await response.Content.ReadAsStringAsync();
    Console.WriteLine(body);
}

Go

package main
 
import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)
 
func main() {
 
	url := "https://site.dealcloud.com/api/rest/v1/oauth/token"
 
	payload := strings.NewReader("scope=data&grant_type=client_credentials
  &client_id=106&client_secret=1356GYNUg3eyOQtw")
 
	req, _ := http.NewRequest("POST", url, payload)
 
	req.Header.Add("content-type", "application/x-www-form-urlencoded")
 
	res, _ := http.DefaultClient.Do(req)
 
	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)
 
	fmt.Println(res)
	fmt.Println(string(body))
 
}

Java

HttpResponse<String> response = Unirest
  .post("https://site.dealcloud.com/api/rest/v1/oauth/token")
  .header("content-type", "application/x-www-form-urlencoded")
  .body("scope=data&grant_type=client_credentials&client_id=106
  &client_secret=1356GYNUg")
  .asString();

Javascript | Nodejs

Axios

import axios from "axios";
 
const options = {
method: 'POST',
url: 'https://site.dealcloud.com/api/rest/v1/oauth/token',
headers: {
  'content-type': 'application/x-www-form-urlencoded'
},
data: {
  scope: 'data',
  grant_type: 'client_credentials',
  client_id: '106',
  client_secret: '1356GYNU'
}
};
 
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});

PHP

<?php
 
$client = new http\Client;
$request = new http\Client\Request;
 
$body = new http\Message\Body;
$body->append(new http\QueryString([
  'scope' => 'data',
  'grant_type' => 'client_credentials',
  'client_id' => '106',
  'client_secret' => '1356GYNU'
]));
 
$request->setRequestUrl(
  'https://site.dealcloud.com/api/rest/v1/oauth/token');
$request->setRequestMethod('POST');
$request->setBody($body);
 
$request->setHeaders([
  'content-type' => 'application/x-www-form-urlencoded'
]);
 
$client->enqueue($request)->send();
$response = $client->getResponse();
 
echo $response->getBody();
?>

PowerShell

$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-RestMethod -Uri 'https://site.dealcloud.com/api/rest/v1/oauth/token' -Method POST -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body 'scope=data&grant_type=client_credentials
&client_id=106&client_secret=1356GYNU'
 

Python

http client

import http.client
 
conn = http.client.HTTPSConnection("site.dealcloud.com")
 
payload = "scope=data&grant_type=client_credentials&client_id=106
&client_secret=1356GYNU"
 
headers = {
    'content-type': "application/x-www-form-urlencoded"
    }
 
conn.request("POST", "/api/rest/v1/oauth/token", payload, headers)
 
res = conn.getresponse()
data = res.read()
 
print(data.decode("utf-8"))

R

httr

library(httr)
 
url <- "https://site.dealcloud.com/api/rest/v1/oauth/token"
 
payload <- "scope=data&grant_type=client_credentials&client_id=106
&client_secret=1356GYNU"
 
encode <- "form"
 
response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)
 
content(response, "text")