SundaySky API Overview

The SundaySky API enables you to securely render and embed personalized videos in real time.

The API is used to POST data elements that you have set up in your data element library (first name, customer type, etc.) to SundaySky's API endpoint. SundaySky then creates a video in real time and returns a base64 string as the response that can be used to play a personalized video for your viewers, using the SundaySky player. Alternatively, you can decode the base64 response and extract different components of the video (such as the video stream URL or captions file URL) and use those components with other video players. Note that when the video is played in a non-SundaySky player, SundaySky-specific functions such as clickable CTAs and analytics are not available.


Before You Begin

Before using the SundaySky API, you'll need to complete the following steps:

1.

Create a video using data fields.

2.

Publish the video to at least one channel.

3.

Get the video ID of the relevant video. You will need this for creating the API URL.
To do this: 

 

a. In Your Videos, locate the relevant video.

 

b. Click the video thumbnail.

 

Video_thumbnail.png

 

c. Copy the string at the end of the URL. This is the video ID.

 

Video_ID.png


Getting the API URL

In general, the SundaySky API uses HTTP POST requests with JSON arguments and JSON responses.

1. POST URL
  https://apis.sundaysky.com/get-video/player-session/<Your SundaySky Video ID>

2.

Request Body:
a flat JSON object with attribute names and values. See Setting up Data Integration for Your Video to learn how to retrieve the JSON field names required for your video.
We recommend including a unique identifier as the value for the id field. This will enable you to accurately report on user video views. For example:
  {
    "firstName": "Mitch",
    "customerType": "Platinum",
    "id": "6tifi6h76fd4t7dj48e7tr7"
}

3.

Headers
  Mandatory
Content-Type: application/json


Optional—This enables the SundaySky platform to correctly determine the viewer's operating system, device type, and browser type.
User-Agent: <user-agent value for the viewer>


Response Codes

Code Message Description
200 OK Video generation process was successful; base64 response is returned.
30X (302, 307, etc.) Temporary redirect Request was redirected; see response location field for the redirect URL.
40X (e.g. 407) Forbidden The request type is malformed or not supported.
501 Not implemented Technical exception. See response body for details.

Embedding the Base64 Response in the Player

<!-- Place div (sskydiv) on your page where the video should appear -->

<div id='sskydiv'></div>
<script>
var sskyProgramID = '<Video ID>';
var sskyResponse = '<Base64 response received from the Video API>';

function createPlayer() {
var sskyplayer = document.createElement('sundaysky-video');
sskyplayer.setAttribute('id', 'sskyplayer');
sskyplayer.setAttribute('analytics-token', sskyProgramID);
sskyplayer.setAttribute('session', sskyResponse);
sskyplayer.setAttribute('poster', 'https://player.sundaysky.com/poster.png');
sskyplayer.setAttribute('transcript-button', 'show');
document.getElementById('sskydiv').appendChild(sskyplayer);
}
createPlayer();
</script>
<script src=
'https://play.sundaysky.com/main/sundaysky-player.grey.en-us.min.js'>
</script>

Was this article helpful?
0 out of 0 found this helpful

Still Have Questions?

SundaySky Support is here for you

contact support