Packaging API Guide

You can embed watermark and package your content using our HTTP-based APIs instead of building a separate server using the CLI embedder or embedder library.

sequenceDiagram participant A as Service site participant B as PallyCon cloud A ->> B: Encoded MP4 B -->> B: Watermark embedding opt Apply Multi-DRM B -->> B: Content encryption end B ->> A: Packaged result Note right of B: DASH / HLS content
(two set with 0, 1 marked)

The packaging storage and job management APIs use the following common specifications:

PallyCon HTTP API Specification

The HTTP API requests used by the PallyCon service follow the specifications below.

Request

Name Value
pallycon-apidata base64 Encoding ( JSON string )

Request Data JSON Format

{
    "data":"{base64 encode(aes256 cbc encrypt(API data))}",
    "timestamp":"{yyyy-mm-ddThh:mm:ssZ}",
    "hash":"{base64 encode(sha256(message format))}"
}

Request Data Specification

Name Value Required Description
data String Y AES encryption on the JSON string generated by the specification for each API, and the result value is input as a base64 string.
timestamp String Y Enter the time of the request at the GMT time zone in “yyyy-mm-ddThh: mm: ssZ” format.
hash String Y Enter the hash value generated according to the following specification.

AES256 Encryption

Aes256 encryption / decryption processing is performed as below using the site key value issued when joining PallyCon service. (Check PallyCon Console site)

  • mode : CBC
  • AES key : 32 byte (Site key issued from PallyCon Console site)
  • AES IV : fixed 16 byte (0123456789abcdef)
  • padding : pkcs7

SHA256 message Format

The input value of the SHA256 hash is a combination of the following strings.

[site access key] + [site_id] + [json.data] + [json.timestamp]
  • site access key: It is the access key value that is issued when creating PallyConsole Cloud service site. It can be checked on the PallyCon Console page.
  • The resulting value of the sha256 hash function must be entered into the base64 function as a byte array type, not as a string.

Storage Registration API

An API that registers storage used for watermark embedding and packaging job. Before you can register a packaging job, you must register the storage that will be used for the job through this API.

Request

  • Use PallyCon Cloud HTTP API specification
  • URL : https://api.pallycon.com/api/v2/storage/[SITE_ID]
  • Method: POST
  • Content type: application/json;charset=UTF-8

The ‘SITE_ID’ part of the URL should be your site ID issued from PallyCon Console site.

Request Data JSON Format

{
    "storage_name" : "{storage name}",
    "type" : "{storage type}",
    "id": "{access id}",
    "password": "{access password}",
    "aws_bucket": "{bucket name}",
    "description" : "{description}",
    "region": "{region}"
}

Request Data Specification

Key type required description
storage_name String Y Name of the storage
type String Y Storage type : S3
id String Y AWS access key id for the storage
password String Y AWS secret access key
aws_bucket String Y Name of S3 bucket
description String N Description of the storage
region String Y Storage’s region code

Response

Response Data JSON Format

{
    "storage_id": "{storage id}",
    "error_code": "{error code}",
    "error_message": "{error message}"
}

Response Data Specification

Key type description
error_code String “0000” : Success, Otherwise it will be alphanumeric error code
error_message String Detailed error message if failed
storage_id String ID of the storage

Storage Update API

An API that modifies storage information used for watermark embedding and packaging operations.

Request

  • Use PallyCon Cloud HTTP API specification
  • Url: https://api.pallycon.com/api/v2/storage/[SITE_ID]
  • Method: PUT
  • Content type: application/json;charset=UTF-8

Request Data JSON Format

{
    "storage_id" : "{storage id}",
    "storage_name" : "{storage name}",
    "description": "{description}"
}

Request Data Specification

Key type required description
storage_id String Y Storage ID
storage_name String N Name of the storage
description String N Description of the storage

Response

Response Data JSON Format

{
    "storage_id": "{storage id}",
    "error_code": "{error code}",
    "error_message": "{error message}"
}

Response Data Specification

Key type description
error_code String “0000” : Success, Otherwise it will be alphanumeric error code
error_message String Detailed error message if failed
storage_id String ID of the storage

Storage List API

An API to get a list of registered storage.

Request

  • Use PallyCon Cloud HTTP API specification
  • Url : https://api.pallycon.com/api/v2/storage/[SITE_ID]
  • Method : GET
  • Content type : application/json;charset=UTF-8

Request Data JSON Format

{
    "search_keyword": "{search keyword}",
    "search_keyword_type": "{storageId / storageName}",
    "storage_type": "S3",
    "region": "{region}",
    "from": "{YYYY-MM-DD'T'hh:mm:ss'Z'}",
    "to": "{YYYY-MM-DD'T'hh:mm:ss'Z'}",
    "page_unit": "{long value}",
    "page_index": "{long value}",
    "time_zone": "{hh:mm}"
}

Request Data Specification

Key type required description
search_keyword String N keyword of the search
search_keyword_type String N Type of search (storageId or storageName)
storage_type String Y Type of storage (S3)
from String N Search parameter for storage registration time
to String N Search parameter for storage registration time
page_unit Int N Number of max result per page. default : 25
page_index Int N Index of result page. default : 1
region String N AWS region code
time_zone String N Timezone for the search

Response

Response Data JSON Format

{
    "error_code": "{error code}",
    "error_message": "{error message}",
    "total_count": "total count",
    "time_zone": "{hh:mm}",
    "data": [{
        "storage_id" : "{storage id}",
        "storage_name" : "{storage name}",
        "type" : "{storage type}",
        "id": "{access id}",
        "password": "{access password}",
        "aws_bucket": "{bucket name}",
        "description" : "{description}",
        "region": "{region}",
        "reg_date": "{YYYY-MM-DD'T'hh:mm:ss'Z'}"
    }]
}

Response Data Specification

Key type description
error_code String “0000” : Success, Otherwise it will be alphanumeric error code
error_message String Detailed error message if failed
storage_id String ID of the storage

Packaging Job Registration API

This API registers new watermark packaging job. Before you can register a packaging job, you must first register a storage and upload the original MP4 file to that storage.

Request

  • Url: https://api.pallycon.com/api/v2/pack/[SITE_ID]
  • Method: POST
  • Content type: application/json;charset=UTF-8

Limitations for trial account

  1. Trial does not support adaptive streaming content packaging.
  2. The original video to be packaged is only supported in the mp4 format.
  3. A trial account can perform only one packaging job.

Request Data JSON Format

{
    "job_name": "{job name}",
    "storage":{
        "input":{
            "storage_id": "{storage id}",
            "contents_path":[ input contents path ]
        },
        "output":{
            "storage_id": "{storage id}",
            "path": "{output path}"
        }
    },
    "content_id": "{content id}",
    "streaming_format": [dash, hls],
    "protect_type": [ drm, watermark ],
    "subtitles":[
        {
        "path": "{subtitle path}",
        "language": "{language}"
        }
    ],
    "watermark_option":{
        "gop": "{gop}"
    }
}

Request Data Specification

Key type required description
job_name String Y Name of packaging job
storage JSON Y Storage and file information for the source video
content_id String Y Unique ID of the content (CID, max 200byte)
streaming_format Array Y Type of streaming format
protection_type Array Y Options to apply DRM and watermark. ‘watermark’ is mandatory while ‘DRM’ is optional.
subtitles JSON Array N Subtitle data, if any.
watermark_option.gop JSON N Input watermark GOP value. default : 60

storage.input

Key type required description
storage_id String Y ID of the storage assigned by PallyCon.
contents_path Array Y The folder / file path where the original file is located. If more than one is specified, they are packaged as an adaptive stream

storage.output

Key type required description
storage_id String Y ID of the storage assigned by PallyCon.
path Array Y The path where the packaging results will be stored

subtitles

Key type required description
path String N Path of the subtitle file
language String N Language of the subtitle file

Response

Response Data JSON Format

{
    "error_code": {error code},
    "error_message": {error message},
    "job_id": {job id}
}

Response Data Specification

Key type description
error_code String “0000” : Success, Otherwise it will be alphanumeric error code
error_message String Detailed error message if failed
job_id Long Returned only on successful job creation

Packaging Job List API

An API used to retrieve a list of packaging jobs from PallyCon packaging server.

Request

  • Url : https://api.pallycon.com/api/v2/pack/{siteId}
  • Method : GET
  • Content type : application/json;charset=UTF-8

Request Data JSON Format

{
    "search_keyword": "{search keyword}",
    "search_keyword_type": "{cid, jobId, jobname}",
    "search_type": "{watermark, sessionKey}",
    "search_status": "{ready, success, failed, complete, working, process}",
    "search_condition": "{dash, hls}",
    "from": "{YYYY-MM-DD'T'hh:mm:ss'Z'}",
    "to": "{YYYY-MM-DD'T'hh:mm:ss'Z'}",
    "page_unit": "{long value}",
    "page_index": "{long value}",
    "time_zone": "{hh:mm}"
}

Request Data Specification

Key type required description
from String N Search parameter for job registration time
to String N Search parameter for job registration time
page_unit Int N Number of max result per page. default : 25
page_index Int N Index of result page. default : 1
search_type String N Search for security option (drm, watermark)
search_status String N Search for job status (ready, success, failed, complete(success + failure), working(pending + processing), job progress, stop)
search_condition String N Streaming format (dash, hls)
search_keyword_type String N Type of search keyword (cid, jobId, jobName)
search_keyword String N Search keyword string
region String N AWS region code
time_zone String N Time zone for the search

Response

Response Data JSON Format

{
    "error_code": "{error code}",
    "error_message": "{error message}",
    "total_count": "{count}",
    "time_zone": "{hh:mm}",
    "data": [ {
        "job_id": "{job id}",
        "job_name": "{job name}",
        "start_date": "{start date({YYYY-MM-DD'T'hh:mm:ss'Z')}",
        "update_date": "{update date({YYYY-MM-DD'T'hh:mm:ss'Z')}",
        "reg_date": "{registered date({YYYY-MM-DD'T'hh:mm:ss'Z')}",
        "watermark": "{watermark use}",
        "drm": "{true/false}",
        "dash": "{true/false}",
        "hls": "{true/false}",
        "content_id": "{content id}",
        "status": "{status}",
        "storage":{
            "input":{
                "storage_id": "{storage id}",
                "contents_path":[ input contents path ]
            },
            "output":{
                "storage_id": "{storage id}",
                "path": "{output path}"
            }
        },
        "subtitles":[ {
            "path": "{subtitle path}",
            "language": "{language}"
        } ]
    } ]
}

Error code

Code Description
0000 Succeeded
A1000 Invalid input parameter
A1002 Invalid timestamp format
A1003 Can not find the site ID
A1006 Failed to decrypt with the site key
A1007 Failed to verify the hash
A4002 Failed to store watermark data
A4003 Failed to create watermark data
A7008 API data parsing error
A7009 Invalid API version