webCOMAND

Process Web Service

Execute cScript code on the server and return the result.

Request

  • cScript: cScript – cScript code to execute.
  • publication: cpath | cql' – Optional cPath or cQL query used to specify the publication for the cScript. The cScript will be processed in the context of the specified publication, including its settings and folders. If not specified, the repository root will be used as the base content folder, and file system output will not be available.
  • asTask: false | true – Perform the request as a task and respond immediately with the task OID and UUID. This is useful for requests that may take time to process. Use the Get Web Service to monitor progress and retrieve results.
  • sessionKey: 'key' – Optional parameter to specify the user session. If it is not specified, the cookie will be checked for the session key.

Response

The following properties are included in the response, in addition to the Common Response Properties.

  • result: 'string' – String that contains the COMAND Script output.

Example

$.ajax({
	url: 'https://hostname.com/rest/process',
	data: {
		publication: '/Publications/Website/Staging',
		cscript: 'insert(Template,Header)'
	},
	success: function( data ) {
		alert( data.status === true ? data.result : 'error' );
	}
});