/sapi/embedcode


Use the /sapi/embedcode endpoint (read-only) to programmatically retrieve the embed code for a content object from the Online Video Platform (mediaclip, project and channel). Learn more about embedding content

Available embed type options:

  • Javascript
    Embed code that delivers players and content on websites or in apps.
  • Iframe
    Standalone HTML embed code wrapped around the Javascript embed code.
  • URL
    URL to use when constructing an iframe manually.
  • AMP
    Standalone HTML embed code wrapped around the Javascript embed code.
  • oEmbed
    Returns an oEmbed URL which can be used to embed a video using oEmbed code. Learn more about oEmbed Service.

1.0 | Object structure

Delivers the (JSON wrapped) javascript formatted embed code for a content object from the Online Video Platform. 

Although usage for projects and channels is possible, the sapi/embed endpoint is mainly used for media clips. 

Example objects available below.

2.0 | Retrieve

Example:

GET /sapi/embedcode/{entity_id}/{playout_name}/{embed_type}/{action}?{query_string}

2.1 | Parameters

Required parametersTypeDescription
{entity_id}intThe id of the entity (media clip, project or channel)
{playout_name}stringThe name of the playout to be used
{embed_type}stringType of embed code: javascript, iframe, url, amp or oembed
Optional parametersTypeDescription
{action}stringAdding “view will return a preview of the embedcode. Adding get will return the embedcode in a JSON encoded string, which is also the default output if no action is provided
{query_string}stringSeveral options. eg. width, height, deeplink (only for the email embed code), thumbWidth, thumbHeight (only for the oEmbed URL)

Examples for each embed type:

2.2 | Example: Javascript embed type

GET https://my-beautiful-publication.bbvms.com/sapi/embedcode/123456/default/javascript

{
"type": "embedcode",
"usetype": "javascript",
"body": "<script type='text/javascript' src='//my-beautiful-publication.bbvms.com/p/default/c/123456.js' ></script>"
}

2.3 | Example: Iframe embed type

GET https://my-beautiful-publication.bbvms.com/sapi/embedcode/123456/default/iframe

{
  "type": "embedcode",
  "usetype": "javascript",
  "body": "<iframe onload=\"this.src += '#!referrer='+encodeURIComponent(location.href)+'&realReferrer='+encodeURIComponent(document.referrer)\" src=\"https://my-beautiful-publication.bbvms.com/p/default/c/123456.html?inheritDimensions=true\" width=\"720\" height=\"405\"  frameborder=\"0\" webkitallowfullscreen mozallowFullscreen oallowFullscreen msallowFullscreen allowfullscreen allow=\"autoplay; fullscreen\"></iframe>"
}

2.4 | Example: URL embed type

GET https://my-beautiful-publication.bbvms.com/sapi/embedcode/123456/default/url

{
  "type": "embedcode",
  "usetype": "url",
  "body": "https://my-beautiful-publication.bbvms.com/p/default/c/123456.html?inheritDimensions=true"
}

2.5 | Example: AMP embed type

GET https://my-beautiful-publication.bbvms.com/sapi/embedcode/123456/default/amp

{
  "type": "embedcode",
  "usetype": "amp",
  "body": "<amp-iframe sandbox=\"allow-scripts allow-same-origin\" layout=\"responsive\" src=\"https://my-beautiful-publication.bbvms.com/p/default/c/123456.html?inheritDimensions=true\" width=\"720\" height=\"540\" frameborder=\"0\" allowfullscreen resizable referrerpolicy=\"unsafe-url\"><div overflow tabindex=\"0\" role=\"button\" aria-label=\"Expand player\">Expand player</div></amp-iframe>"
}

2.6 | Example: oEmbed embed type

GET https://my-beautiful-publication.bbvms.com/sapi/embedcode/123456/default/oembed

{
  "type": "embedcode",
  "usetype": "oEmbed",
  "body": "https://my-beautiful-publication.bbvms.com/oembed/?url=https%3A%2F%2Fmy-beautiful-publication.bbvms.com%2Fp%2Fdefault%2Fc%2F123456.html&width=720&height=405&thumbWidth=720&thumbHeight=405&format="
}

 

Was this article helpful?

Related Articles