Try this API
Call this method on live data to see the API request and response. Need help with the API Explorer?
Request parameters
You have invalid or missing required parameter values above.
Execute
Developers

JS SDK

The SDK methods can be used to initialize and set up extensions. You can also get or set entity details using these methods. Developers can call the methods while developing an internal extension by importing OrchestlySDK to the HTML file.

Example:





However, if you are hosting an external extension this import may not be required.

Know more about internal and external extensions.

Contents

init

This is the first command to be executed for initializing the extension.


var OrchestlyClient =  OrchestlySDK.init();
   
 OrchestlyClient.then(function(app) {    
/* Use this space and build interactive app using the sdk . 
Below is an example to get the user name*/ 
        OrchestlySDK.get('user.name').then(function (data) {
            //response Handling
        }).catch(function (err) {
            //error Handling
        });    
});

metadata

This command provides the configuration data of the extension. Secure data cannot be viewed in the response.


OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('app.config').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });

Response:


{"app.config":[{"name":"testTest"},{"name":"testTestWithoutDefault","value":"wedwd"},
{"name":"testEmail","value":"helenc@zylker.com"},
{"name":"testEmailWithoutDefault","value":"helenc@zylker.com"},
{"name":"testpassword","value":"eqweqw"},{"name":"testcheckbox",
"value":"true"},{"name":"testradio","value":"valueRadio1"},
{"name":"testing switch"},{"name":"testselect","value":"valueselect1"},
{"name":"testnumber","value":"5"},{"name":"testmultiline","value":"this is multi line"}
]}

get

This method is used to request data from the source. In Qntrl, you can fetch the details of jobs, blueprints, and users using this method.

The following keys are supported by the 'get' method:

Jobs

Get job ID

Fetch the job ID in which the current widget is hosted.


OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('job.jobid').then(function (data) {
            //response Handling
        }).catch(function (err) {
            //error Handling
        });    
    });

Response:


{job.jobid:"job_ID"}

Get extension ID

Fetch the ID of the current widget.


OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('job.extensionid').then(function (data) {
            //response Handling
        }).catch(function (err) {
            //error Handling
        });    

Response:


{job.extensionid:"extension_ID"}

Get blueprint ID

Fetch the blueprint ID in which the current widget is hosted.


 OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('job.blueprintid').then(function (data) {
            //response Handling
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


{job.extensionid:"blueprint_ID"}

Get current transition ID

Get the transition ID in which the current widget is hosted.

This function can be used only if the widget's location is 'job.detail.during.popup'.


 OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('job.currenttransitionid').then(function (data) {
            //response Handling
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


{job.currenttransitionid:"current_transition_ID"}

Get comment

Get the comment posted in the current widget.

This function can be used only if the widget's location is 'job.detail.comment.popup'.


 OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('job.currentcommenttext').then(function (data) {
            //response Handling (this key scope is only inside the comment popup)
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


{job.currentcommenttext:"current_comment"}

Get attachments

Get the files attached to the current widget.


 OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('job.attachments').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


	{  
   " job.attachments: [{"   author_name":"helen",
   "created_time":"1537188713357",
   "file_name":"Party Invite",
   "dfs_file_path":null,
   "created_by_dp":null,
   "created_date_hours":null,
   "type":1,
   "created_by":"771000000002001",
   "type_value":"JOB",
   "file_size":0,
   "block_id":null,
   "attachment_url":"/blueprint/api/attachment/771000000163237",
   "extension_attachment_id":"1vfx-IFvA8DF9cEZy7ZyemZQbxD9JwEKe1pbYR5DUjMw",
   "zuid":"55120107",
   "extension_attachment_details":"{\"filename\":\"Party Invite\",
   \"content_type\":\"application/vnd.google-apps.form\",\"size\":\"\",
   \"download_url\":\"https://
   drive.google.com/uc?authuser=0&
   id=1vfx-IFvA8DF9cEZy7ZyemZQbxD9JwEKe1pbYR5DUjMw&export=download\",
   \"view_url\":\"https://docs.google.com/forms/
   d/1vfx-IFvA8DF9cEZy7ZyemZQbxD9JwEKe1pbYR5DUjMw/edit?
   usp=drivesdk\",\"id\":\"1vfx-IFvA8DF9cEZy7ZyemZQbxD9JwEKe1pbYR5DUjMw\",
   \"thumbnail_url\":\"https://docs.google.com/feeds/
   vt?gd=true&id=1vfx-IFvA8DF9cEZy7ZyemZQbxD9JwEKe1pbYR5DUjMw&v=3&
   s=AMedNnoAAAAAW5-_hkdiMq28Nz_p2YMPdjezUn1s346H&sz=s220\"}",
   "content_type":"application/vnd.google-apps.form",
   "added_via":"extension",
   "attachment_type":1,
   "user_id":"771000000002001",
   "job_id":"771000000163157",
   "attachment_id":"771000000163237",
   "attachment_type_value":"JOB",
   "created_date":null,
   "author_id":"771000000002001"
}
]
}

Get job details

Get the details of the job in which the current widget is hosted.


 OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('job.jobdetails').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


"job.jobdetails":{  
   "jobid":"352000000044009",
   "no":"38",
   "jobCustomFields":{  
      "352000000000082":"",
      "352000000000192":"",
      "352000000000084":"",
      "352000000000032":"",
      "352000000000212":""
   },
   "record_owner_name":null,
   "jobFieldId":{  
      "UDF_DOUBLE1":"352000000000212",
      "UDF_USER1":"352000000000152",
      "UDF_TEXT2":"352000000000084",
      "UDF_TEXT1":"352000000000082",
      "UDF_PKL1":"352000000000102",
      "UDF_CHAR1":"352000000000032",
      "UDF_DATE1":"352000000000192"
   },
   "prefix":"DS",
   "duedate":"",
   "description":"
", "title":"cscs", "priority":"Low" }

Blueprints

Get all blueprints

Get a list of all the blueprints available in the organization.

Both active and inactive blueprints will be listed.


 OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('blueprint.list').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


[  
   {  
      "modified_on":null,
      "is_locked":false,
      "layout_id":"814000000000116",
      "is_active":true,
      "description":"Created by Layout - Default Layout",
      "is_default":true,
      "draft_id":null,
      "created_on":null,
      "created_ontime":null,
      "modified_ontime":null,
      "name":"Common Blueprint",
      "modified_by":"814000000002001",
      "id":"814000000000122",
      "position":0
   }
]
									

Get all transitions

Get a list of all the transitions occurring in the blueprint.


 OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('blueprint.transitionlist').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


[  
   {  
      "process_id":"814000000000122",
      "des_stage_id":"814000000000040",
      "data":"{\"toPort\":\"T3\"}",
      "transitionrulemap_details":[  

      ],
      "transitionsource_details":[  

      ],
      "is_global":false,
      "transition_id":"814000000000125",
      "transition_name":"working on it"
   },
   {  
      "process_id":"814000000000122",
      "des_stage_id":"814000000000043",
      "data":"{\"toPort\":\"T3\"}",
      "transitionrulemap_details":[  

      ],
      "transitionsource_details":[  

      ],
      "is_global":false,
      "transition_id":"814000000000128",
      "transition_name":"work accomplished"
   },
   {  
      "process_id":"814000000000122",
      "des_stage_id":"814000000000037",
      "data":"{\"toPort\":\"R1\"}",
      "transitionrulemap_details":[  

      ],
      "transitionsource_details":[  

      ],
      "is_global":false,
      "transition_id":"814000000000131",
      "transition_name":"start again"
   }
]
									

Get blueprint ID

Fetch the blueprint ID in which the current widget is hosted.


 OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('blueprint.id').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


{blueprint.blueprintid:"job_id"}
										

Get transition ID

Fetch the transition ID in which the current widget is hosted.

This function can be used only if the widget's location is 'job.detail.during.popup'.


OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('blueprint.transitionid').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


{blueprint.transitionid:"transition_id"}

Users

Get user ID

Get the ID of the current user.


OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('user.id').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


{user.id :"job_ID"}
									

Get user email

Get the email address of the current user.


OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('user.email').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


{user.email :"email_ID"}

Get user name

Get the name of the current user.


OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('user.name').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


{user.name :"Current_User_Name"}
									

Get user image

Get the image of the current user.

A download URL containing the image will be returned


 OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('user.pic').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


{user.pic:"download_URL"}
									

General

Get the base URL of the organization.

The base URL's format will be: 'blueprint/organization_name'.


 OrchestlyClient.then(function(App) {     
        OrchestlySDK.get('general.baseurl').then(function (data) {
            //response Handling 
        }).catch(function (err) {
            //error Handling
        });    
    });  

Response:


{general.baseurl:"/blueprint/"}
									

Set

This method is used to send data to the server for updating a value at the source. In Orchestly, you can modify the details of job and extension properties.

The following keys are supported by the 'set' method:

Jobs

Perform transition

Perform transition in the job associated with the current widget.

This function can be used only if the widget's location is 'job.detail.during.popup'.


 OrchestlyClient.then(function(App) { 
        OrchestlySDK.set('job.performtransition').then(function (data) {
            //response Handling
        }).catch(function (err) {
            //error Handling
        });
    });  

Response:


{"success" : true}
									

Job attachments

Attach files to the job associated with the current extension.


  OrchestlyClient.then(function(App) { 
        OrchestlySDK.set('job.attachments',attachData).then(function (data) {
                 //response Handling
            }).catch(function (err) {
                //error Handling
        }); 
    });  

Name Type Object Details
attachData Array of JSONObject Key Description Value
id ID of the source file to be linked to the extension.
download_url URL of the attachment. Example: https://www.dropbox.com/s/cvqrkganxdxat1m/download-4.jpeg?dl=0
filename Name of the attachment. Example: worksheet.xls

Response:


{"success" : true}
									

CSS properties

Modify properties like height and width of the current widget.


  OrchestlyClient.then(function(App) { 
        OrchestlySDK.set('app.preference',value).then(function (data) {
                //response Handling
            }).catch(function (err) {
                //error Handling
        });
    });  

Name Type Object Details
value JSONObject Key Description Value
minHeight Mention the minimum height and width for the widget in pixels. Example: 100px
maxHeight Mention the maximum height and width for the widget in pixels. Example: 150px

Response:


{"success" : true}
									

request

This method is used to invoke a third-party URL from the extension.

The connectionLinkName defined in the plugin-manifest.json file will be invoked.


  OrchestlyClient.then(function(App) { 
            var options = { 
                type: "get/post" ,
                secure : true|false,
                payload:"request_payload",
                parameters:{},
                headers:{}
            };

            OrchestlySDK.request(url,options,connectionLinkName).then(function (value) {
                    //response Handling
                }).catch(function (err) {
                    //error Handling
            })
        });  

Name Type Description
URL URL of the third-party service.
options Array
Key Type Description
secure Boolean Mention 'true' to secure your request.
type Mention the type (GET/POST) of request.
parameters Object Parameters of the request.
header Object Header of the request.
payload String Payload of the request.
connectionLinkName Value mentioned in plugin-manifest.json.

Response:


{  
   "url":" https://cliq.zoho.com/api/v2/channels/O17226000000004029/message",
   "type":"POST",
   "payload":{  
      "text":"dwadwqd"
   }
}