NAV
php javascript

Info

Here you will find the documentation of the API enabling the users of the platform Babelee to access the functionalities to generate and render videos.
Get Babelee API Postman Collection

Authentication

[POST] Login

Example request:


$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://babelee.littlesea.tv/api/v1/login",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => false,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('email' => '{{email}}','password' => '{{password}}'),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var form = new FormData();
form.append("email", "{{email}}");
form.append("password", "{{password}}");

var settings = {
  "url": "https://babelee.littlesea.tv/api/v1/login",
  "method": "POST",
  "timeout": 0,
  "processData": false,
  "mimeType": "multipart/form-data",
  "contentType": false,
  "data": form
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

Example response (200):

{
    "success": {
        "token": "{{token}}"
    }
}

This endpoint is used to generate a bearer token which enables the user to do all the other api calls.

HTTP Request

POST https://babelee.littlesea.tv/api/v1/login

POST fields

Parameter Description
email The mail on which the user have to authenticate.
password The password of the user.

Video Generation

This endpoint is used to generate a bearer token which enables the user to do all the other api calls.

[POST] generateVideo

This endpoint allows the user via a POST request to generate the video by starting from a given project and a descriptor of the personalization that should be done on the project.

Example request:

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://babelee.littlesea.tv/api/v1/generateVideo",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => false,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array(
    'd' => '{"name":"Marco"}',
    'pid' => '{{project_id}}',
    'ref' => 'https://babelee.littlesea.tv', 
    'poster' => 'https://babelee.littlesea.tv/assets/images/misc/poster.jpg'
  ),
  CURLOPT_HTTPHEADER => array(
    "Accept: application/json",
    "Authorization: Bearer {{token}}"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var form = new FormData();
form.append("d", "{'name':'Marco'}");
form.append("pid", "{{project_id}}");
form.append("ref", "https://babelee.littlesea.tv");
form.append("poster", "https://babelee.littlesea.tv/assets/images/misc/poster.jpg");

var settings = {
  "url": "https://babelee.littlesea.tv/api/v1/generateVideo",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Accept": "application/json",
    "Authorization": "Bearer {{token}}"
  },
  "processData": false,
  "mimeType": "multipart/form-data",
  "contentType": false,
  "data": form
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

Example response (200):

{
    "success": {
        "video": "https://babelee.littlesea.tv/video/[VIDEO TOKEN]",
        "embed_link": "https://babelee.littlesea.tv/embed/[VIDEO TOKEN]",
        "embed_code": "[IFRAME TO THE VIDEO]",
        "token": "[VIDEO TOKEN]"
    }
}

HTTP Request

POST https://babelee.littlesea.tv/api/v1/generateVideo

Authorization

Parameter Description
token The bearer token generated from the login request.

POST Fields

Parameter Description
pid The project id on which the video generation should be done.
d A JSON describing how the personalization should be done. This JSON isprovided when the project has been generated.
ref (optional) The referral from which the generated video should be accessible
poster (optional) The URL to a poster that should be shown when the video has been initially loaded

Video Render

[POST] render

This endpoint allows the user via a POST request to submit a MP4 render to the render queue.

Example request:

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://babelee.littlesea.tv/api/v1/render",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => false,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => array('video_token' => '{{video_token}}'),
  CURLOPT_HTTPHEADER => array(
    "Accept: application/json",
    "Authorization: Bearer {{token}}"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var form = new FormData();
form.append("token", "{{video_token}}");

var settings = {
  "url": "https://babelee.littlesea.tv/api/v1/render",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Accept": "application/json",
    "Authorization": "Bearer {{token}}"
  },
  "processData": false,
  "mimeType": "multipart/form-data",
  "contentType": false,
  "data": form
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

Example response (200):

{
    "success": {
        "status": "The render has been correctly submitted"
    }
}

HTTP Request

POST https://babelee.littlesea.tv/api/v1/render

Authorization

Parameter Description
token The bearer token generated from the login request.

POST Fields

Parameter Description
video_token The video token generated from the generateVideo requests on which the render should be activated.

[GET] render/status/{{video_token}}

This endpoint allows the user via a GET request to retrive the status of a render in progress.

Example request:

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://babelee.littlesea.tv/api/v1/render/status/{{video_token}}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => false,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Accept: application/json",
    "Authorization: Bearer {{token}}"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
var settings = {
  "url": "https://babelee.littlesea.tv/api/v1/render/status/{{video_token}}",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Accept": "application/json",
    "Authorization": "Bearer {{token}}"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

Example responses (200):

{
    "success": {
        "status": "PENDING"
    }
	
}
{
    "success": {
        "status": "RENDERING"
    }
	
}
{
    "success": {
        "status": "DONE",
	"url":"https://littleseastorage.blob.core.windows.net/babelee/{{video_token}}.mp4"
    }
}

HTTP Request

GET https://babelee.littlesea.tv/api/v1/render/status/{{video_token}}

Authorization

Parameter Description
token The bearer token generated from the login request.

Query Parameters

Parameter Description
video_token The video token generated from the generateVideo requests on which the render have been activated.

Errors Codes

This section describes the possible errors that could be generated from the API

Error Code Meaning Notes
400 Bad Request – Is not correctly formed or is missing some parameters If a parameter is missing, this is generally described in a response JSON
401 Unauthorized – Your bearer token is incorrect or the credential provieded are not valid
405 Method Not Allowed – You tried to access with an invalid method
500 Internal Server Error – We had a problem with our server. Try again later.
503 Service Unavailable – We’re temporarially offline for maintanance. Please try again later.