Retrieving Embedded Content

The Live Center web service includes a proxy service for formatting embedded content. The proxy URL is:

http://host-ip-address/live-center-presentation-webservice/proxy/

The proxy service, merges the embedded content URL with the appropriate HTML template and returns the resulting HTML snippet so all you have to do is insert it at the correct location.

A rich text field containing an embedded tweet looks something like this:

{
  "name": "xhtml", 
  "value": "<p>Look, a tweet!</p>
            <p>
              <a xmlns=\"http://www.w3.org/1999/xhtml\" 
                 href=\"https://twitter.com/threadless/status/606078523548266496\" 
                 class=\"esc-social-embed esc-tag-Twitter\">
              </a>
            </p>"
}

To display the tweet, all you need to do is to pass its URL on to the proxy service like this:

http://host-ip-address/live-center-presentation-webservice/proxy/?url=https://twitter.com/threadless/status/606078523548266496

The proxy service will then respond with a JSON structure containing the merged HTML:

{ 
  "html":"<blockquote class="twitter-tweet" lang="en"> 
            <a href="https://twitter.com/threadless/status/596560045782990848"></a>
          </blockquote>
          <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>",
  "provider_name":"Twitter" 
}

You can then just replace the original <a/> element with the content of the xhtml field.