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.

Permissions

To make successful API calls, you need to ensure the intended user has the right permissions. The user needs to belong to a User Group that has the "API" capability turned on. This can be enabled by navigating to Admin > User Management, selecting the relevant user group, and turning on "API" under Site Areas. If you do not see the Admin section in the navigation, you may need to reach out to an admin on your team or your DealCloud CSM.

Authentication

Once the right permissions are in place, click on the User icon at the top-right of your screen and select Profile. Scroll down and enable your API Key, which will generate your Client ID and Secret. These are needed to generate a Token.

Scopes

When generating a token, you need to provide a scope. The API supports the scopes listed below, which can be combined if needed. The caption below indicates which scope is needed for each functional area. For most requests, data is the appropriate scope needed. The scope will not provide more capability then the user account has within the platform. It is not reccommended to request extraneous (or all) scopes in your token request, only the one(s) you require.

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
backupThis scope is used when working with the Site Backup 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")