Screendragon API

Screendragon’s Application Programming Interface

Screendragon RESTful API

The Screendragon API is aRESTful API that allows 3rd parties to integrate with the Screendragon platform.

The API leverages OAuth2 so therefore a valid token needs to be included in all API requests to be permitted. Please contact your Screendragon account manager to receive a unique client id and secret for your application.

All requests return a JSON response and require a JSON body where required.

Download Postman Collection

A project management tool interface with a rocket icon and download button.

A basic postman collection can be downloaded from here. This collection contains a request to return the details of the api user. Please ensue that you add your client id & secret at the collection root.

End Point: https://apisandbox.screendragon.com/sdapi/api/users/me

A typical response would look like:

sd {
“userID”: 12345,
“userName”: “apiuser”,
“firstName”: “John”,
“lastName”: “Smith”,
“email”: “noreply@staging2.screendragon.com”,
“customFields”: [],
“status”: “active”,
“createDate”: “2014-10-01T11:49:32”,
“groups”: []
}

Documentation

The Screendragon documentation can be viewed here:

https://apisandbox.screendragon.com/sdapi/

The Screendragon documentation can be viewed here:

https://apisandbox.screendragon.com/sdapi/

API Access

Please contact your Screendragon Account Manager for your unique Client ID & Secret for the API Sandbox site.

Please note these expire after 24 hours. If you already have a site hosted by Screendragon contact your Account Manager.

Code Examples

.Net
Utilizing Newtonsoft and RestSharp Libraries

sd using Newtonsoft.Json.Linq;
using RestSharp;
using System;
namespace SandboxAPI
{
class Program
{
static void Main(string[] args)
{

string clientId = “YOUR_CLIENT_ID”;
string clientSecret = “YOUR_CLIENT_SECRET”;

var client = new RestClient(“https://apisandbox.screendragon.com/sdapi/OAuth/Token”);
var request = new RestRequest(Method.POST);
request.AddHeader(“cache-control”, “no-cache”);
request.AddHeader(“content-type”, “application/x-www-form-urlencoded”);
request.AddParameter(“application/x-www-form-urlencoded”, “grant_type=client_credentials&scope=all&client_id=” + clientId + “&client_secret=” + clientSecret, ParameterType.RequestBody); RestResponse response = client.Execute(request);
dynamic resp = JObject.Parse(response.Content);
string token = resp.access_token;
client = new RestClient(“https://apisandbox.screendragon.com/sdapi/api/users/me”);
request = new RestRequest(Method.GET);
request.AddHeader(“authorization”, “Bearer ” + token);
request.AddHeader(“cache-control”, “no-cache”);
response = client.Execute(request);
}
}
}

Javascript/Typescript
A library such as (https://www.npmjs.com/package/client-oauth2) can be utilized to implement the OAuth 2 flow.

sd // Client credentials

var clientId = ‘YOUR_CLIENT_ID’;
var clientSecret = ‘YOUR_CLIENT_SECRET’;

//Call the API
fetch(‘https://apisandbox.screendragon.com/sdapi/OAuth/Token’, {
method: ‘POST’,
body: ‘grant_type=client_credentials&client_id=’ + clientId + ‘&client_secret=’ + clientSecret,
headers: {
‘Content-Type’: ‘application/x-www-form-urlencoded’
}
}).then(function (response) {
return response.json();
}).then(function (data) {
// Return a second API call
// This one uses the token we received for authentication
return fetch(‘https://apisandbox.screendragon.com/sdapi/api/users/me’, {
headers: {
‘Authorization’: data.token_type + ‘ ‘ + data.access_token,
‘Content-Type’: ‘application/x-www-form-urlencoded’
}
});
}).then(function (response) {
console.log(response);
return response.json();
}).then(function (data) {
console.log(data);
}).catch(function (err) {
console.log(‘Error’, err);
});

Further Help

Please email your Screendragon Account Manager to arrange further technical assistance.