Applinks Resource

Use the Applinks resource (applinks) to request access to a folder or file for a specified user and role.

To create an applink, the requester must have admin privileges for the folder or file. That is, the requester must be the owner or have the manager role.

You can grant the specified user any standard role except the manager or owner role.

  • Viewer: Viewers can look at files and folders but can't change things.

  • Downloader: Downloaders can also download files and save them to their own computers.

  • Contributor: Contributors can also modify files, update files, upload new files, and delete files.

For an example of an applink definition, see Examples in the description of "Create File Applink" under Applinks.

Applink Encryption

All necessary resource object, user, and role information is encrypted and stored in the elements identified in the following table. These elements are returned with the applink response and are used to programmatically carry out other operations on behalf of the associated user for a defined period of time.

Service calls using an applink must include the associated appLinkID and accessToken values in the request header.

Parameter Description

appLinkID

This element uniquely identifies the resource.

accessToken

This element provides access to the resource and expires after 15 minutes. You can refresh the access token any number of times within the time period defined by the refresh token (24 hours).

refreshToken

This element enables you to request a new access token when the current access token expires. The refresh token expires after 24 hours.

Locales for the userLocale Applink Parameter

The following table lists locale codes and the locales they represent for the userLocale applink parameter.

Locale Code Locale

cs

Czech

da

Danish

de

German

el

Greek

en-CA

English-CA

en-GB

English-UK

en-US

English-US

es

Spanish

fi

Finnish

fr

French

fr-CA

French-Canadian

hu

Hungarian

it

Italian

ja

Japanese

ko

Korean

nl

Dutch

nb

Norwegian_Bokm??l

no

Norwegian

pl

Polish

pt

Portuguese-Portugal

pt-BR

Portuguese-Brazilian

ru

Russian

sk

Slovak

sv

Swedish

th

Thai

tr

Turkish

ro

Romanian

zh-CN

Chinese-Simplified

zh-TW

Chinese-Traditional

Applink Events

The Applinks resource supports the AppLinkReady event.

Event Description

AppLinkReady

Rather than send the required token data in a URL, which would make the tokens publicly visible and store them in various caches, this message is sent from an HTML inline frame (iframe tag) that contains the embedded user interface, to notify the parent window that the inline frame is ready to receive data from the Oracle Content Management server.

Message Handler Example

To pass the necessary keys (the short-term dAppLinkAccessToken and the long-term dAppLinkRefreshToken) into the inline frame without exposing them in a URL, use the AppLinkReady event. The basic steps follow:

  1. The inline frame that contains the embedded user interface uses a URL without keys to make the initial call to the Documents Cloud server.

  2. The server downloads JavaScript to the inline frame, which posts the AppLinkReady message to the parent window.

  3. The parent window posts data to the inline frame that contains the keys.

  4. The inline frame sends another URL to the Documents Cloud server with the short-term key in the header (not in the URL).

The following example illustrates a simple message handler. The createAppLink function referenced in the example is not shown but is assumed to return the necessary applink resource data:

$( document ).ready(function() {
	var id = "<Folder or File ID>";
	var role = "contributor";
	var assignedUser = "<User ID>";
	// createAppLink function not shown but assumed to return appLink resource data obtained 
	//    from Create Folder Applink or Create File Applink service
	var appLink  = createAppLink(id, role, assignedUser);
  	function OnMessage (evt) {          
		if (evt.data.message === 'appLinkReady') {
			
			var iframe= $('#applink_iframe')[0];
			var iframewindow= iframe.contentWindow ? iframe.contentWindow : iframe.contentDocument.defaultView;

			var msg = {
				message: 'setAppLinkTokens',
				appLinkRefreshToken:appLink.refreshToken,
				appLinkAccessToken:appLink.accessToken,
				appLinkRoleName:role,
				embedPreview: true
			}
			
			iframewindow.postMessage(msg, '*???);
 		}
	};
	window.addEventListener && window.addEventListener('message', OnMessage, false);
});

Applinks APIs

For REST endpoints and API descriptions, see Applinks.