Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Reverted from v. 14

This article describes the API used to develop client plug-ins, as well as client-side form scripts.

...

The following standard functions are supported: get, post, put and delete.

The parameter "base" must contain an eventually configured context path. Therefore "scope.api.config.get()" should be used to retrieve the service base including the context path. The configuration "scope.api.config.get().loginBase" contains the context path itself and can be used to concatenate custom base URLs.

If If you want a format different from JSON, you have to add a third parameter {responseType: 'arraybuffer' | 'blob' | 'json' | 'text'}.

scope.api.http.get

Code Block
languagejs
titleExample for get
linenumberstrue
// 1st example: show some user´s inbox workitems in the message box:
scope.api.http.get('/get?size=10', scope.api.config.get().inboxBase).'/inboxservice').then(
	function(result) {
	    var inbox='';
		result.data.content.forEach(function(row) {
			inbox+=row.title+'</br>';
		});
		scope.api.util.notifier.success(inbox,'Some inbox workitems');
	},
	function(error) {
		scope.api.util.notifier.error('Failed to load inbox', 'Error');
	}
);


// 2nd example: show all users' favorites
scope.api.http.get('/service/user/favorites', scope.api.config.get().serviceBase'/rest-ws').then(
	function(result) {
	    var favs='';
		result.data.forEach(function(row) {
			favs+=row.title+'</br>';
		});
		scope.api.util.notifier.success(favs,'Your favorites');
	},
	function(error) {
		scope.api.util.notifier.error('Failed to load favorites', 'Error');
	}
);

// 3rdFor example:more owninformation, customsee servicethe withREST context path
function descriptions.

scope.api.http.

...

scope.api.http.put

...

put

Code Block
languagejs
titleExample for put
linenumberstrue
// how to change object data
var objectId = '7B683C8E19BD492198F6A262D14EF43F';
var changeBody = {'status': 'active'};
scope.api.http.put('/service/dms/'+objectId, changeBody, scope.api.config.get().serviceBase'/rest-ws').then(
	function(result){
		scope.api.util.notifier.info('Status changed to "active"', 'Success');
	},
	function(error){
		scope.api.util.notifier.error('Failed to change object data for ' + objectId, 'Error');
	}
);

// For more information, see the REST function descriptions.

...

Code Block
languagejs
titleExample for del
linenumberstrue
// how to delete an object
var objectId = '7B683C8E19BD492198F6A262D14EF43F';

scope.api.http.del('/service/dms/' + objectId, scope.api.config.get().serviceBase).'/rest-ws').then(
	function(result) {
	    scope.api.util.notifier.info('Deleted object ' + objectId, 'Success');
	},
	function(error) {
		scope.api.util.notifier.error('Failed to delete object ' + objectId, 'Error');
	}
);

// For more information, see the REST function descriptions.

...

Code Block
languagejs
titleExample for post
linenumberstrue
// how to create a subscription
var objectId = '7B683C8E19BD492198F6A262D14EF43F';
var body = {subject: 'My subscription', type: 'document'};


scope.api.http.post('/service/dms/subscription/' + objectId, body, scope.api.config.get().serviceBase).'/rest-ws').then(
	function(result){
		scope.api.util.notifier.info('Created subscription for ' + objectId, 'Success');
	},
	function(error){
		scope.api.util.notifier.error('Failed to create subscription for ' + objectId, 'Error');
	}
);

// For more information, see the REST function descriptions.

scope.api.dms

This section describes the read access to object information.

scope.api.dms.getObject()

Loads a DMS object from the backend

ParameterTypeDescription
idstringThe id of the DMS object to be fetched.
typestringoptional: The object type of the selected DMS object. Will improve performance if set.
versionstringoptional: retrieve a specific version of the DMS object.

...

ParameterTypeDescription
dmsObjectDmsObjectthe DMS object with the content to download
renditionstring(optional) the type of the content file ('PDF', 'TIFF', 'TEXT', 'JPEG') if you don't want to have the original file

scope.api.config

Gets information about configurations.

scope.api.config.get()

...

This function returns information about the location of special resources (including an eventually configured context path).

...

.

structure serviceinboxBase URL yuuvis® RAD inbox servicebpmBase URL yuuvis® RAD bpm serviceloginBase URL context path of the yuuvis® RAD gateway.empty if no context path is configured.
config entrydescription
serviceBaserelative URL to the yuuvis® RAD rest services
pluginsBaserelative path to the plug-ins project folder
pluginStatesBaserelative path to the plug-in states project folder
themeBaserelative path to the themes folder

scope.api.agent

These functions help to handle custom actions with yuuvis® RAD agent.

scope.api.agent.getAvailability()

This function gets the agent availability and returns a promise which is resolved with the agent availability.

PromiseDescription
agentAvailability.CONNECTEDThe user has an agent connected and the current browser session is connected.
agentAvailability.AVAILABLEThe user has an agent connected to the system, but there is no pairing between the current browser session and an agent.
agentAvailability.UNAVAILABLEThe user is not connected with any agent.


For examples, see the 
Client-side Custom Action Scripting documentation.

...