Pulsar Content Library API
Content Library Operations
getContentURL
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;