Pulsar Content Library API

Content Library Operations
getContentURL

The getContentURL query returns a local, offline URI for any content library document. The returned URI can be used to load the documents directly within the browser session. For instance, a user may need to navigate through a series of HTML documents or load multimedia such as PDF files or video content. The ContentDocument Salesforce ID OR the ContentDocument Title must be provided to retrieve the proper file URI.

Be aware: getContentUrl returns a valid URL that may include query parameters that are used by Pulsar. Should you need to include query parameters, please check for the existence of them on the URL returned by this request and ensure that they remain in place when you load the URL. Appending a query string to the URL returned by this request without checking for any pre-existing query parameters may result in undesired behavior.

var request = { 
	"type" : "getContentUrl",
	"data" : { 
         "Id" : "069012345678912", // id of the content doc
         "Title" : "Salesforce Document Title" // title of the content doc
    } 
};
bridge.sendRequest(request, function (results) {
   console.log('Javascript got its response: ' + results);
   if (results.type === "contentURLResponse")	{
     var url = results.data.url;
     var title = results.data.title;
     //do something with the title and url...
   } else if (results.type == 'error') {
         errStr = results.data;
         alert('A problem occurred:\n' + errStr);
   }
});
    

Additionally, if using this feature to load other HTML documents that will use the API bridge, it is recommended not to re-initialize the bridge. You must ensure that the bridge is saved to the global state (window) in order to pass between files. See below:

// initialize the master bridge, then save it to the global state
window.mybridge = masterbridge;

// then in the next loaded page reference the
// bridge in the global state
var samplebridge = window.mybridge;
 
// if you are only loading in an iFrame you should be referencing the parent as each iFrame is a separate window.
var sampleIframeBridge = window.parent.mybridge;