OCLC Developer Network

Incorporating External Content

External URLs, web pages and applications can be proxied into an OpenSocial container. This can be done in one of two ways:

  • Content Redirect
  • Content Proxy

A Content Redirect acts similar to an iFrame and allows developers to bring in existing web page content. The gadget uses any relatively urls within the HTML code and keeps the web page exactly as it originally appeared. Developers can created signed Content Redirects by adding at an authz attribute to the Content element.

Example

<?xml version="1.0" encoding="UTF-8"?>
<Module>
    <ModulePrefs
            title="OCLC Developer Network Test"
            width="1024"
            height="350"
            scrolling="true"
            author="Karen Coombs"
            author_email="coombsk@oclc.org"
            screenshot="http://www.librarywebchic.net/mashups/opensocial/images/proxy.jpg"
            thumbnail="http://www.librarywebchic.net/mashups/opensocial/images/proxy_thumb.jpg">
        <Require feature="opensocial-0.9" />
    </ModulePrefs>
    <Content href="http://www.oclc.org/developer/" type="url" view="default" />
</Module>

In contrast a Content Proxy normalizes the body of the content returned with existing HTML. This typically breaks any relatively links present in the HTML in the original page. The information returned doesn't have to be valid HTML but merely an HTML snippet. When using Content Proxy developer can use additional attributes as part of the request, this includes:

  • authz
  • oauth_received_callback
  • oauth_request_token
  • oauth_request_token_secret
  • oauth_service_name
  • oauth_token_name
  • oauth_use_token
  • refresh_interval
  • sign_owner
  • sign_viewer

Example

<?xml version="1.0" encoding="UTF-8"?>
<Module>
    <ModulePrefs
            title="OCLC Developer Network Test"
            width="1024"
            height="350"
            scrolling="true"
            author="Karen Coombs"
            author_email="coombsk@oclc.org"
            screenshot="http://www.librarywebchic.net/mashups/opensocial/images/proxy.jpg"
            thumbnail="http://www.librarywebchic.net/mashups/opensocial/images/proxy_thumb.jpg">
        <Require feature="opensocial-0.9" />
    </ModulePrefs>
    <Content href="http://www.oclc.org/developer/" type="html" view="default" />
</Module>

OpenSocial gadgets which use Content Proxying can pass data to these external proxied URL via Data Pipelining.

Example

<?xml version="1.0" encoding="UTF-8"?>
<Module>
    <ModulePrefs
            title="OCLC Developer Network Test"
            width="1024"
            height="350"
            scrolling="true"
            author="Karen Coombs"
            author_email="coombsk@oclc.org"
            screenshot="http://www.librarywebchic.net/mashups/opensocial/images/proxy.jpg"
            thumbnail="http://www.librarywebchic.net/mashups/opensocial/images/proxy_thumb.jpg">
        <Require feature="opensocial-0.9" />
        <Require feature="opensocial-data" />
    </ModulePrefs>
    <Content href="" type="html" view="default" xmlns:os="http://ns.opensocial.org/2008/markup">
        <os:Var key="termID" value=""/>
    </Content>
</Module>

Follow the OCLC Developer Network:

The OCLC Developer Network supports the use of OCLC Web Services—a set of tools and APIs that expose data and services for WorldCat and our member libraries and partner institutions or companies. learn more »

© 2010 OCLC Domestic and international trademarks and/or service marks of OCLC Online Computer Library Center, Inc. and its affiliates


Powered by Drupal, an open source content management system