Deluge for API Calls

Deluge for API Calls

Using Deluge Scripting, you can make API calls easily from ServiceDesk Plus MSP Cloud to any third-party applications.

ServiceDesk Plus MSP Cloud REST APIs enable you to perform all operations that you execute through the web client. To understand the APIs available in ServiceDesk Plus MSP Cloud and their structures, refer to the V3 API documentation in the application (Admin > General > API).

Info
API calls will be triggered through the account of the support rep whose API key is configured in the custom function. You can make API calls to other service desk instances if the support rep account that you use has sufficient permissions for the API calls. 

API Calls Within ServiceDesk Plus MSP Cloud    

Write custom functions in the following syntax to trigger API calls within ServiceDesk Plus MSP Cloud:
  1.  response = invokeurl
  2. [
  3. url: "http://servername:portnumber/api/v3/<....>"
  4. type: POST\GET\PUT\DELETE
  5. parameters: {"input_data":<INPUT_DATA>,"TECHNICIAN_KEY":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","PORTALID":<HELPDESKID>}
  6. ]; 

Sample API Calls  

1. Get the list of requests in the application

  1. resp = invokeurl
  2. [
  3. url: "http://servername:portnumber/api/v3/requests"
  4. type:GET
  5. parameters: {"TECHNICIAN_KEY":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","PORTALID":<PORTALID>}
  6. ]; 

2. Fetch the first 50 requests created in the application that are currently open

  1. resp = invokeurl
  2. [
  3. url: "http://servername:portnumber/api/v3/requests"
  4. type:GET
  5. parameters: {"input_data":{"list_info":{"row_count":"50","search_criteria":{"field":"status.name","condition":"is","value":"Open"}}},"TECHNICIAN_KEY":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","PORTALID":<HELPDESKID>}
  6. ]; 

3. Create a request with the subject 'New Issue'

  1. resp = invokeurl
  2. [
  3. url: "http://servername:portnumber/api/v3/requests"
  4. type: POST
  5. parameters: {"input_data":{"request":{"subject":"new issue"}},"TECHNICIAN_KEY":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","PORTALID":helpdeskID}
  6. ]; 

In the above sample, the API response in the 'resp' variable will be in JSON format since ServiceDesk Plus MSP Cloud v3 API responses are in JSON format. In further lines of code, you can use the 'resp' variable like any other variable. The API response must be treated as the 'Map' data type.

API Calls to External Applications  

Write custom functions in the following syntax to trigger API calls to any external applications:
  1. resp = invokeurl[
  2. url: <URL>
  3. type: <GET|POST|PUT|DELETE|PATCH>
  4. parameters: <PARAMETERS>
  5. headers: <HEADERS>
  6. files: <FILE_NAME>
  7. ]; 

Use the following pointers to fill out the custom function details:

<URL>: Provide your API URL.

<PARAMETERS>: Specify the parameters of your API.

<HEADERS>: Provide the authorization details of the third-party application. For example, if your API accepts 'authtoken', then provide the authtoken generated for the third party application.

<FILE_NAME>: If you are triggering an API to submit a file (received from another API's response), specify the file name in this space.