How to upload your contents to THRON DAM PLATFORM

Business Case:

KPI to be measured

Bookmark this resource Follow

Ask a question

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

[tab:Actions]

With THRON DAM PLATFORM you can import contents to the platform in complete autonomy, even in massive mode.

Users and Administrators have various options, including:

The first massive import is included in the onboarding and you will be guided by your Customer Success Manager. To receive information about massive imports and the related services that THRON provides, please contact your Sales Account or write to support@thron.com .

 

Uploading via browser

Via browser, you can upload one or more contents from your PC in manual mode:

  • by clicking the + button and selecting “From PC”:

    fromPC.png

  • by “drag and drop”, dragging the contents from your local folders direction into THRON.

The final step is to specify the type of content you are uploading and whether you wish it to be available for download by other platform users.

Schermata_2022-04-06_alle_13.25.25.png

 

Once uploaded, the contents will be visible in your My Content area. To share them directly to another specific folder as well, simply position on the folder before importing the content.

 

 

Uploading via FTP

If you need to upload contents over 5GB in size, THRON provides you with a specific FPT area (see “Platform Limits” – “Content” Section for more information).

Follow these steps to upload your contents via the FTP area:

  1. Install a client FTP on your computer. Once the client has been installed, you can recover the credentials for access to the FTP server directly from THRON DAM PLATFORM;
  2. Click Media > From FTP to upload a new content:

    fromFTP.png

  3. Click "Connecting to the FTP server" to recover the credentials:

    credential_ftp.png

  4. Enter the credentials you have recovered in the respective fields of the client FTP and access the server. Once connected, you can import the files to the dedicated area.
    CAUTION! Upload the contents directly to the root of the FTP area (you cannot upload whole folders containing files via FTP); otherwise, the THRON DAM PLATFORM publication interface will not be able to see them. If you need to upload entire content folders to THRON DAM PLATFORM, go to the "Upload via THRON DESKTOP CLIENT" section of this article.

  5. After completing the transfer of the contents to the FTP area, in THRON DAM PLATFORM click the + button and then Media > From FTP and select the files you just imported:

    select_image_ftp.png

    CAUTION! The FPT area is a temporary repository for uploading your files. Contents uploaded to it are automatically removed after 15 days: import them to THRON DAM PLATFORM before this deadline as otherwise they will be lost.

  6. The final step is to specify the type of content you are uploading and whether you wish it to be available for download by other platform users.

    Schermata_2022-04-06_alle_13.25.25.png

 

 

Upload via THRON DESKTOP CLIENT

THRON Desktop Client is an app which can be installed on a Windows or Mac PC, and which enables users to display, open and work with the contents present in THRON using the software installed on their own computers, without having to create local copies of them.

This application also enables users to upload large contents and whole directories of folders, together with the contents they contain, to THRON.

THRON Desktop Client is able to manage contents up to 30GB in size.

 

DESKTOP_CLIENT_NEW.gif

 

You can find more information about the application in the dedicated section in the MarketPlace

You can read the Platform Limits article for more details on the limits that must be met when uploading content.

 

[/tab][tab:Code Samples] [dropdown:REST - CONTENT UPLOAD]

The uploadFile function,used to add a file to repository is located within xpackager, in the “repository” package.

In order to use it you must have a valid platform token, obtainable by logging into platform.

 

In the body of the request, minimum information to be included are:

  • clientId: compiled using the service code name (usually the company name)

  • tokenId: filled with the value obtained from the login service

  • FileSource: this field indicates the file to be loaded into storage. After the “@” character you must specify the physical path through which the file can be reached, while after "filename=" you will have to specify the name by which the file will be loaded

 

The headers that should be used for the request, which must be in POST are:

  • Content-Type: multipart / form-data

 

The url of the service is formatted according to the structure:

//<clientId>-view.thron.com/api/xpackager/resources/repository/uploadFile

Where <clientId> is the name of the service code as used for the body of the request.

In the response you will get the actual name of the file in repository, as you may have added a suffix to avoid homonyms.

The insert function, used to publish a file thus creating an effective content, is located within Xadmin in the “content” package.

In order to use it you must have a valid token platform, obtainable by logging in to the platform.

 

In the body of the request, minimum information to be included are:

  • contentType: a string describing the type of the content to be created: Available content types are VIDEO, AUDIO, IMAGE, OTHER, PLAYLIST, PAGELET.
  • sources: the parameter describing the origin of the content's source file. Available choices are:
    • bucket: the name of the S3 bucket used for uploading the source file.
    • filePath: the absolute path of the source file inside the S3 bucket.
    • newFileName: the desired file name to be assigned to the source file into THRON Platform without extension. The file name will not be sanitized. However, to allow downloading of the original file through all browsers there is a filter on allowed characters. In the presence of the characters " * : < > ? / \ | the service will return the error code 418.
    • url: the public url of the resource.
    • buffer: the body of the Page content itself, base64 encoded with UTF-8 charset. Maximum allowed size is 2MB.
    • mimeType: used to specify the mimeType of the buffer, usually is "text/html".
    • repo: if you wish to import a source file previously uploaded to repository with the uploadFile function. You will have to provide the repositoryFileId.
    • ftp: if you wish to import a source file previously uploaded to FTP server. You will have to provide the fileName.
    • s3: if you wish to import a source file which has been previously uploaded into an S3 bucket. You will have to provide the following information:
    • webif you wish to create a new content directly from a web resource. You will have to provide the following information:
    • raw: if you wish to create a Page content. You will have to provide the following information:

 

If you wish to create a playlist you will have to provide the following information within the playlistOpt parameter:

  • template: which is basically the type of playlist you are going to create, AUDIO VIDEO or IMAGE.
  • xcontentIds: which is the array of xcontentIds of the elements composing the new playlist.

 

Additional parameters are:

  • contentOpt: all the basic information on the content itself.
  • linkedCategoryIds: the array of category Ids into which the content has to be published upon publication.
  • silentMode: a boolean parameter which will allow you to determine wether notifications must be sent at the end of content transcoding process. This is particularly useful when you plan to make massive content import.

 

The request, which must be in POST, have the following headers:

  • Content-Type: application / json

  • X-TokenId: XXXXX (using the token obtained through the login)

 

The url of the service is formatted according to the structure:

//<clientId>-view.thron.com/api/xadmin/resources/content/insert/<clientId>

Where [clientId] is the name of the service code as used for the body of the request.

[/dropdown][dropdown:REST - PUBLISHING VIA FTP]


{
    "param": {
        "contentType": "<insert here content type, might be IMAGE, VIDEO, AUDIO or OTHER>",
        "contentOpt": {
            "initAllLocales": false,
            "basicInfoByLocale": [{
                "locale": "<insert here the locale, e.g.: EN>",
                "name": "<insert here content title>",
                "description": "<insert here content description>",
                "prettyId": "<insert here a label for this content>"
            }],
            "linkedCategoryIds": [
                "<categoryId of the folder in which you want to publish the content>"
            ]
     },
      "sources": [{
          "ftp": {
            "fileName": "<file name in the dedicated FTP area>"
        }
    }]
  },
    "silentMode": false
}    

[/dropdown]

[dropdown:REST - PUBLISHING VIA S3]

At this link you can find an archive containing the AWS libraries to perform an upload towards an S3 bucket and a php sample which can be filled with some parameters in order to perform the upload. The same archive can be found in the attachments of this article.

In the response of the php you will obtain the URL and the request body of the insert web service which can be used in order to create the content in THRON.

The parameters which have to be filled in the php (uploadFileS3Token.php) are:

  • $strKey: to be filled with the response body of the getS3UploadCredentials request, put the whole JSON in a single line;
  • $pathFile: the whole path of the file to be uploaded;
  • $keyname=$arJsonCre->path.: the file name including extension;
  • $contentTypeFile: the mimetype, which is the file type to be uploaded (you can find a full list here);
  • $nameFileToTHRON: the title to be assigned to the content in THRON;
  • $authorFileToTHRON: the full name of the content's author;
  • $typeFileToTHRON: the THRON's content type (IMAGE, AUDIO, VIDEO, OTHER, etc.);
  • $clientIDToTHRON: your clientId;

 

[/dropdown]

[dropdown:REST - PUBLISHING VIA WEB]


{
    "param": {
        "contentType": "<insert content type, might be IMAGE, VIDEO, AUDIO or OTHER>",
        "contentOpt": {
            "initAllLocales": false,
            "basicInfoByLocale": [{
                "locale": "<insert the locale , e.g.: EN>",
                "name": "<insert content title>",
                "description": "<insert content description>",
                "prettyId": "<insert a label for this content>"
            }],
            "linkedCategoryIds": [
                "<categoryId of the folder in which you want to publish the content>"
            ]
    },
    "sources": [{
        "web": {
            "url": "<url of the file to be uploaded>",
            "newFileName": "<name to be assigned to the file in the THRON repository>"
        }
    }],
    "silentMode": false
 }
}    

[/dropdown]

[dropdown:REST - PUBLISHING A PAGE]


{
    "param": {
        "contentType": "PAGELET",
        "contentOpt": {
            "initAllLocales": false,
            "basicInfoByLocale": [{
                "locale": "<insert the locale, e.g.: EN >",
                "name": "<insert content title>",
                "description": "<insert content description>",
                "prettyId": "<insert a label for this content>"
            }],
            "linkedCategoryIds": [
                "<categoryId of the folder in which you want to publish the content>"
            ]
    },
    "sources": [{
        "raw": {
            "buffer": "<insert the body of the page, base64 encoded>",
            "mimeType": "text/html"
        }
    }],
    "silentMode": false
 }
}    

[/dropdown]

 

 

Multiple content import

The following scripts can be used to perform multiple content import into THRON, these samples are commented and can be configured at will according to the content type and the source of the files. Please remind that "silent" parameter must be set to true.

[dropdown:JAVA - MULTIPLE CONTENT IMPORT]


import it.newvision.nvp.xadmin.model.MEContentType;
import it.newvision.nvp.xadmin.services.model.content.MResponsePublishContents;
import it.newvision.nvp.xadmin.services.model.request.MContentinsertReq;
import it.newvision.nvp.xadmin.services.model.content.MPublishParams;
import it.newvision.nvp.xadmin.services.model.content.MContentOpt;
import it.newvision.nvp.xadmin.services.rest.JContentClient;
import it.newvision.nvp.xadmin.services.model.content.MContentBasicInfo;
import org.codehaus.jackson.map.ObjectMapper;
import it.newvision.nvp.xadmin.services.model.content.MSourceOpt;
import it.newvision.nvp.xadmin.services.model.content.MSourceFtpOpt;

import java.util.*;
/**
 * #################################################################################### 
 * @author stefano.bisello
 * @copyright 2016
 * ####################################################################################
 *
 * INFO
 * How to create new content
 * WebService THRON:  https://developer.thron.com/#!/content/insert
 *
 */
public class contentInsert {

 public static void main(String[] args) {

  /*SETUP FILE*/
  String clientId = "CLIENT THRON";
  String tokenID = "TOKENID";
  boolean initAllLocales = true; // init all locale content
  String contentLocale = "IT"; //content locale info
  String contentOwner = "NAME OWNER CONTENT"; //content owner
  MEContentType typeContent = MEContentType.IMAGE; //type of content (ex IMAGE.OTHER.VIDEO.AUDIO ...)
  List linkContentToCategory = Arrays.asList("IDCATEGORY THRON 1", "IDCATEGORY THRON 2", "..."); //link content to THRON category
  boolean silentMode = true; // disable notifications
  // List file present in THRON FTP
  String[] arrayFileFromFTP = {
   "IMAGE 1",
   "IMAGE 2",
   "IMAGE 3",
   "IMAGE 4",
   "IMAGE 5",
   "IMAGE 6",
   "IMAGE 7",
   "IMAGE 8",
   "IMAGE 9",
   "..."
  };
  // MAIN
  //init object for output
  ObjectMapper mapper = new ObjectMapper();
  //define request THRON
  JContentClient contentClient = new JContentClient("http://" + clientId + "-view.thron.com/api/xadmin/resources");

  //execute request
  try {
   for (int x = 0; x < arrayFileFromFTP.length; x = x + 1) {
    // pause 1 second
    Thread.sleep(1000);
    //generate request param
    MContentinsertReq newContentData = new MContentinsertReq();
    MPublishParams contentParam = new MPublishParams();
    MContentOpt contentOpt = new MContentOpt();
    List contentBasicInfo = new ArrayList();
    List sourceOpt = new ArrayList();

    MSourceFtpOpt sourceFtpOpt = new MSourceFtpOpt();
    //set content type
    contentParam.setContentType(typeContent);
    //set content Opt initAllLocales
    contentOpt.setInitAllLocales(initAllLocales);
    // set link categories
    contentOpt.setLinkedCategoryIds(linkContentToCatogory);
    //set owner
    contentOpt.setOwner(contentOwner);
    //content info (name,description,locale)
    contentBasicInfo.add(new MContentBasicInfo());
    contentBasicInfo.get(0).setDescription(" new file" + arrayFileFromFTP[x]);
    contentBasicInfo.get(0).setLocale(contentLocale);
    contentBasicInfo.get(0).setName(arrayFileFromFTP[x]);
    contentOpt.setBasicInfoByLocale(contentBasicInfo);
    contentParam.setContentOpt(contentOpt);
    //file source
    sourceOpt.add(new MSourceOpt());
    sourceFtpOpt.setFileName(arrayFileFromFTP[x]);
    sourceOpt.get(0).setFtp(sourceFtpOpt);
    contentParam.setSources(sourceOpt);
    //add param
    newContentData.setParam(contentParam);
    //set SilentMode
    newContentData.setSilentMode(silentMode);
    // System.out.println(mapper.writeValueAsString(newContentData));
    // add content to THRON from request
    MResponsePublishContents ris = contentClient.insert(tokenID, clientId, newContentData, null);
    //RESULT THRON OUTPUT
    System.out.println(mapper.writeValueAsString(ris));
   }

  } catch (Exception e) {
   //error THRON OUTPUT
   System.out.println(e);
  }
 }
}    

[/dropdown] [dropdown:PHP - MULTIPLE CONTENT IMPORT]


<?php
/**
 * ####################################################################################
 * @author stefano.bisello
 * @copyright 2016
 * ####################################################################################
 *
 * INFO
 * How to create new content
 * WebService THRON:  https://developer.thron.com/#!/content/insert
 *
 * ####################################################################################
 * config
 * ####################################################################################
 */
/*SETUP FILE*/
set_time_limit(3620);

// client

$client_idTHRON = 'CLIENT THRON';

// TOKEN THRON

$tokenID = 'TOKENID';

// ID THRON

$initAllLocales = "true"; // init all locale content
$contentLocale = "IT"; //content locale info
$contentOwner = "NAME OWNER CONTENT"; //content owner
$linkContentToCatogory = array(
    "IDCATEGORY THRON 1",
    "IDCATEGORY THRON 2",
    "..."
); //link content to THRON category
$silentMode = true; // disable notifications
$contentType = "IMAGE"; //(ex IMAGE.OTHER.VIDEO.AUDIO ...)

// List file present in THRON FTP

$arrayFileFromFTP = array(
    "IMAGE 1",
    "IMAGE 2",
    "IMAGE 3",
    "..."
);

// #########################################################################################
// UTILITY
// #########################################################################################
// insert content to THRON

function insertContentTHRON($client_id, $tokend, $bodyRequest)
    {

    // configure request webService THRON

    $url = "http://" . $client_id . "-view.thron.com/api/xadmin/resources/content/insert/" . $client_id;

    // header  request webService THRON

    $header = array(
        "Content-Type: application/json",
        "X-TOKENID:" . $tokend
    );

    // request THRON

    $request = json_encode($bodyRequest);

    // configure curl

    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_HEADER, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
    $curlRes = curl_exec($curl);
    $curlResInfo = curl_getinfo($curl);
    curl_close($curl);

    // parse response

    $resHeadersString = substr($curlRes, 0, $curlResInfo['header_size']);
    $resBody = substr($curlRes, $curlResInfo['header_size']);
    $response = json_decode($resBody, true);

    // print_r($resBody);

    return $response;
    }

// #########################################################################################
// main
// #########################################################################################
// array response insert

$risInsert = array();

// insert content to THRON Platform

for ($i = 0; $i < count($arrayFileFromFTP); $i++)
    {

    // generate body request

    $bodyRequest = array(
        "param" => array(
            "contentType" => $contentType,
            "contentOpt" => array(
                "initAllLocales" => $initAllLocales,
                "basicInfoByLocale" => array(
                    array(
                        "locale" => $contentLocale,
                        "name" => $arrayFileFromFTP[$i],
                        "description" => "new file:" . $arrayFileFromFTP[$i]
                    )
                ) ,
                "owner" => $contentOwner,
                "linkedCategoryIds" => $linkContentToCatogory
            ) ,
            "sources" => array(
                array(
                    "ftp" => array(
                        "fileName" => $arrayFileFromFTP[$i]
                    )
                )
            ) ,
        ) ,
        "silentMode" => $silentMode
    );

    // execute request

    $risInsert[] = insertContentTHRON($client_idTHRON, $tokenID, $bodyRequest);
    } 
?>

[/dropdown]

[/tab]

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

Have any question?

Open a ticket
Comments