oEmbed

XperienCentral provides access for external web clients to the Advanced Search functionality in order to allow you to retrieve content. An XperienCentral application key is required in order to authenticate a client to access the Advanced Search dialog box. The application key can be generated and retrieved from the Authorization panel in XperienCentral.

The Advanced Search dialog box is available at the following URL:

http://{domain}/{contextpath}/dialog/contentsearch?locale={locale}&appkey={mysecretkey}

For example:

http://backend1/web/dialog/contentsearch?locale=nl_NL&appkey=8b7e1a1c2996c920b6f

opens the Advanced Search panel in an iframe in order to allow you to search for and retrieve a content item in XperienCentral. The dialog communicates with your external web client across the domain by means of an HTML 5 window.postMessage API and the selected item can be retrieved by adding an event listener to the contentItemSelect postMessage. For example:

window.addEventListener("message", onMessage, false);


/**
 * Example event handler that handles the contentItemSelect post message
 *
 * @param selected: { 
 *    data: {
 *      action: { "select" },
 *      items: [
 *        contentItemIdentifier: "pageversion-2",
 *        locale: "nl_NL",
 *        url: "http://frontend1/web/share/1b97ab2f52794e6acbb"
 *      ]
 *    }
 * }
 **/
function onMessage(selected) {
  if (event.data.message === "contentItemSelect") { 
        if (event.data.action !== "cancel") {
      var item = selected.data.items[0];
      console.log(item.url, item.contentItemIdentifier, item.locale);
    } else {
          // event.data.action === "select"
      output.value = "canceled";
    }
  }
}


The "capability URL" that is returned can be used to retrieve the oEmbed representation from the XperienCentral oEmbed API which is available at:

http://{domain}/{contextpath}/services/oembed?url=<url>

For example:

http://frontend1/web/services/oembed?url=http://frontend1/web/share/1b97ab2f52794e6acbb

The oEmbed service returns an oEmbed response according to the oEmbed specification. For complete information, see http://www.oembed.com/. The XC oEmbed server supports JSONP for cross domain requests by adding a callback or jsonpCallback (jquery/dojo standards) with the callback function name to the oEmbed request. For example:

http://frontend1/web/services/oembed?url=http://127.0.0.1/web/share/39952826dcfedba0b0bb&callback=mycallbackfunction

or

http://frontend1/web/services/oembed?url=http://127.0.0.1/web/share/39952826dcfedba0b0bb&jsonpCallback=mycallbackfunction

Presentations

The example presentation shows an example of how to render XperienCentral content for the oEmbed channel on the oEmbed "Display on" page that can be configured in XperienCentral (Configuration > Channel Configuration > Special Pages).

  • A content item is requested by providing a contentitemid and optionally a contentitemversionid request parameter which are used to determine the correct element holder from which the content will be rendered on the "Display on" page.
  • The main presentation, "WM page embed", should be assigned to the oEmbed "Display on" page which is responsible for building an SSI URL for rendering the requested content item by the "WM page embed ssi" presentation. This presentation also provides caching functionality.
  • The "WM page embed ssi" presentation determines the type of content that is requested (page, page section, media item, database type etc.) and it renders the requested content item by invoking the standard "WM content" and "WM databasepage" presentations.