Functions

A function is a snippet code that provides better modularity for your extensions. Developers can use these functions for server-side operations. Functions are built in the Deluge script builder, where you can drag-and-drop and create complex functions seamlessly.

Functions are also a part of the extension. They are used to execute a specific parts of the functionalities available in the extension. A chunk of deluge scripts, with the aim of executing a particular task, are encapsulated and implemented at multiple events, making it a reusable entity.

Example: You can add an item comment or add an attachment to the item from your widget using the DRE functions.

Learn all about creating a function here.

Visit our API doc to learn how to execute function.

If you want to know more about DRE functions, kindly click here.

To call other service APIs, refer link.

Function Execution

Sample Request

sdk.request({
url: /zsapi/team/784663487/extensions/6774743767436743/functions?functionUuid={function_uuid}&version=
{function_version},
method: "post",
payload,
connectionLinkName: "testing"
}).then((response)=>{});

Note: You can get payload from function data using the payload parameter.

Sample Response

{
	"responseBody": {
		"response": {
			"code": 200,
			"text": "Document attached successfully"
		},
		"status": "success"
	},
	"responseHeaders": {
		"date": "Tue, 02 Jan 2024 10:01:05 GMT",
		"server": "ZGS",
		"content-length": "83",
		"expires": "Thu, 01 Jan 1970 00:00:00 GMT",
		"x-rate-limit": "[{\"duration\":300,\"remaining-count\":199}]",
		"x-frame-options": "DENY",
		"x-download-options": "noopen",
		"pragma": "no-cache",
		"strict-transport-security": "max-age=63072000",
		"x-content-type-options": "nosniff",
		"content-disposition": "attachment; filename=response.json;",
		"x-robots-tag": "noindex, nofollow, noarchive, nosnippet",
		"content-type": "application/json;charset=UTF-8",
		"connection": "keep-alive",
		"cache-control": "private,no-cache,no-store,max-age=0,must-revalidate",
		"content-language": "en-US"
	},
"responseCode": 200,
"status": "success"
}

 

Response in the responseBody is returned by the function.