Note: The following applies to Zendesk, Salesforce, ServiceNow, and Azure Devops. For Jira Cloud, please see this article.
This article shows how to do REST API calls that haven't been implemented into Exalate by making requests with the HTTP client directly in the script rules.
Below you can find some examples of how Jira HTTP Client can be used in Exalate configuration.
Example of using 'httpClient' in ZenDesk
Call:
httpClient.get("/api/v2/tickets/"+entity.id+"/"+"comments")
Response:
{
"comments": [{
"id": 21767477874193,
"type": "Comment",
"author_id": 15223656380689,
"body": "Fixed Ticket",
"html_body": "Fixed Ticket",
"plain_body": "Fixed Ticket",
"public": true,
"attachments": [],
"audit_id": 21767477874065,
"via": {
"channel": "api",
"source": {
"from": {},
"to": {
"name": "",
"address": ""
},
"rel": null
}
},
"created_at": "2024-01-18T10:28:33Z",
"metadata": {
"system": {
"client": "AHC/2.1",
"ip_address": "",
"location": "",
"latitude": __,
"longitude": __
},
"custom": {}
}
},
{
"id": 21767520220049,
"type": "Comment",
"author_id": 15223656380689,
"body": "New attachment received from remote side:",
"html_body": "New attachment received from remote side:",
"plain_body": "New attachment received from remote side:",
"public": true,
"attachments": [{
"url": "",
"id": 21767471409937,
"file_name": "20230516_155546.jpg",
"content_url": "g",
"mapped_content_url": "",
"content_type": "image/jpeg",
"size": 37771,
"width": 640,
"height": 759,
"inline": false,
"deleted": false,
"malware_access_override": false,
"malware_scan_result": "malware_not_found",
"thumbnails": [{
"url": "",
"id": 21767478028561,
"file_name": "20230516_155546_thumb.jpg",
"content_url": "",
"mapped_content_url": "",
"content_type": "image/jpeg",
"size": 2062,
"width": 67,
"height": 80,
"inline": false,
"deleted": false,
"malware_access_override": false,
"malware_scan_result": "malware_not_found"
}]
}],
"audit_id": 21767487816593,
"via": {
"channel": "api",
"source": {
"from": {},
"to": {
"name": "",
"address": ""
},
"rel": null
}
},
"created_at": "2024-01-18T10:28:38Z",
"metadata": {
"system": {
"client": "AHC/2.1",
"ip_address": "",
"location": "",
"latitude": _,
"longitude": _
},
"custom": {}
}
}
],
"next_page": null,
"previous_page": null,
"count": 86
}
Also, we can get ContentDocument (Attachment) with the following call:
httpClient.get("/services/data/v54.0/sobjects/ContentDocument/{id})
Response:
{
"attributes": {
"type": "ContentDocument",
"url": "/services/data/v54.0/sobjects/ContentDocument/0690600000XYEuBAAX"
},
"Id": "0690600000XYEuBAAX",
"CreatedById": "0050600000HEIOGAA5",
"CreatedDate": "2024-01-18T08:33:51.000+0000",
"LastModifiedById": "0050600000HEIOGAA5",
"LastModifiedDate": "2024-01-18T08:33:51.000+0000",
"IsArchived": false,
"ArchivedById": null,
"ArchivedDate": null,
"IsDeleted": false,
"OwnerId": "0050600000HEIOGAA5",
"SystemModstamp": "2024-01-18T08:36:47.000+0000",
"Title": "IMG_0011",
"PublishStatus": "P",
"LatestPublishedVersionId": "0680600000Y3RpiAAF",
"ParentId": null,
"LastViewedDate": "2024-01-18T08:34:39.000+0000",
"LastReferencedDate": "2024-01-18T08:34:39.000+0000",
"Description": null,
"ContentSize": 292869,
"FileType": "JPEG",
"FileExtension": "jpeg",
"SharingOption": "A",
"SharingPrivacy": "N",
"ContentModifiedDate": "2024-01-18T08:33:51.000+0000",
"ContentAssetId": null
}
Or feedItems (Comments)
httpClient.get("/services/data/v54.0/sobjects/"+entity.entityType+"/"+entity.id+"/"+"casecomments").records
httpClient.get("/services/data/v54.0/sobjects/"+entity.entityType+"/"+entity.id+"/"+"casecomments").records
Response:
{
"totalSize": 1,
"done": true,
"records": [{
"attributes": {
"type": "CaseComment",
"url": "/services/data/v54.0/sobjects/CaseComment/00a06000016zkYCAAY"
},
"Id": "00a06000016zkYCAAY",
"ParentId": "5000600006Ns5tsAAB",
"IsPublished": false,
"CommentBody": "case comment three",
"CreatedById": "0050600000HEIOGAA5",
"CreatedDate": "2024-01-04T17:08:10.000+0000",
"SystemModstamp": "2024-01-04T17:08:10.000+0000",
"LastModifiedDate": "2024-01-04T17:08:10.000+0000",
"LastModifiedById": "0050600000HEIOGAA5",
"IsDeleted": false
}]
}
Example of using "httpClient" in Salesforce
In Salesforce this can’t be done in the same way because there are some differences between JCloud REST API and SF REST API. Here, using REST API we can get all Tasks connected to a certain case.
Call:
httpClient.get("/services/data/v54.0/subjects/"+entity.entityType+"/"+entity.id+"/"+"tasks").records
Response:
{
"totalSize": 2,
"done": true,
"records": [{
"attributes": {
"type": "Task",
"url": "/services/data/v54.0/sobjects/Task/00T06000066Qv3sEAC"
},
"Id": "00T06000066Qv3sEAC",
"WhoId": null,
"WhatId": "5000600006Ns5tsAAB",
"Subject": "Other",
"ActivityDate": null,
"Status": "In Progress",
"Priority": "Normal",
"IsHighPriority": false,
"OwnerId": "0050600000HEIOGAA5",
"Description": null,
"IsDeleted": false,
"AccountId": null,
"IsClosed": false,
"CreatedDate": "2024-01-16T16:22:27.000+0000",
"CreatedById": "0050600000HEIOGAA5",
"LastModifiedDate": "2024-01-16T16:22:27.000+0000",
"LastModifiedById": "0050600000HEIOGAA5",
"SystemModstamp": "2024-01-16T16:22:27.000+0000",
"IsArchived": false,
"CallDurationInSeconds": null,
"CallType": null,
"CallDisposition": null,
"CallObject": null,
"ReminderDateTime": null,
"IsReminderSet": false,
"RecurrenceActivityId": null,
"IsRecurrence": false,
"RecurrenceStartDateOnly": null,
"RecurrenceEndDateOnly": null,
"RecurrenceTimeZoneSidKey": null,
"RecurrenceType": null,
"RecurrenceInterval": null,
"RecurrenceDayOfWeekMask": null,
"RecurrenceDayOfMonth": null,
"RecurrenceInstance": null,
"RecurrenceMonthOfYear": null,
"RecurrenceRegeneratedType": null,
"TaskSubtype": "Task",
"CompletedDateTime": null
},
{
"attributes": {
"type": "Task",
"url": "/services/data/v54.0/sobjects/Task/00T06000066QwEmEAK"
},
"Id": "00T06000066QwEmEAK",
"WhoId": null,
"WhatId": "5000600006Ns5tsAAB",
"Subject": "Second One",
"ActivityDate": null,
"Status": "In Progress",
"Priority": "Normal",
"IsHighPriority": false,
"OwnerId": "0050600000HEIOGAA5",
"Description": null,
"IsDeleted": false,
"AccountId": null,
"IsClosed": false,
"CreatedDate": "2024-01-17T13:46:12.000+0000",
"CreatedById": "0050600000HEIOGAA5",
"LastModifiedDate": "2024-01-17T13:46:12.000+0000",
"LastModifiedById": "0050600000HEIOGAA5",
"SystemModstamp": "2024-01-17T13:46:12.000+0000",
"IsArchived": false,
"CallDurationInSeconds": null,
"CallType": null,
"CallDisposition": null,
"CallObject": null,
"ReminderDateTime": null,
"IsReminderSet": false,
"RecurrenceActivityId": null,
"IsRecurrence": false,
"RecurrenceStartDateOnly": null,
"RecurrenceEndDateOnly": null,
"RecurrenceTimeZoneSidKey": null,
"RecurrenceType": null,
"RecurrenceInterval": null,
"RecurrenceDayOfWeekMask": null,
"RecurrenceDayOfMonth": null,
"RecurrenceInstance": null,
"RecurrenceMonthOfYear": null,
"RecurrenceRegeneratedType": null,
"TaskSubtype": "Task",
"CompletedDateTime": null
}
]
}
Example of using 'httpClient' in ServiceNow
Call:
httpClient.get("/api/now/v1/table/incident?sysparm_query=number=" + entity.key)
Response:
{
"result": [{
"parent": "",
"made_sla": "true",
"caused_by": "",
"watch_list": "",
"upon_reject": "cancel",
"sys_updated_on": "2024-01-22 08:39:47",
"child_incidents": "0",
"hold_reason": "",
"origin_table": "",
"task_effective_number": "INC0010001",
"approval_history": "",
"number": "INC0010001",
"resolved_by": "",
"sys_updated_by": "admin",
"opened_by": {
"link": "https://dev137186.service-now.com/api/now/v1/table/sys_user/6816f79cc0a8016401c5a33be04be441",
"value": "6816f79cc0a8016401c5a33be04be441"
},
"user_input": "",
"sys_created_on": "2024-01-22 08:39:45",
"sys_domain": {
"link": "https://dev137186.service-now.com/api/now/v1/table/sys_user_group/global",
"value": "global"
},
"state": "1",
"route_reason": "",
"sys_created_by": "admin",
"knowledge": "false",
"order": "",
"calendar_stc": "",
"closed_at": "",
"cmdb_ci": "",
"delivery_plan": "",
"contract": "",
"impact": "3",
"active": "true",
"work_notes_list": "",
"business_service": "",
"business_impact": "",
"priority": "5",
"sys_domain_path": "/",
"rfc": "",
"time_worked": "",
"expected_start": "",
"opened_at": "2024-01-22 08:39:45",
"business_duration": "",
"group_list": "",
"work_end": "",
"caller_id": "",
"reopened_time": "",
"resolved_at": "",
"approval_set": "",
"subcategory": "",
"work_notes": "",
"universal_request": "",
"short_description": "New Task",
"close_code": "",
"correlation_display": "",
"delivery_task": "",
"work_start": "",
"assignment_group": "",
"additional_assignee_list": "",
"business_stc": "",
"cause": "",
"description": "New Comment",
"origin_id": "",
"calendar_duration": "",
"close_notes": "",
"notify": "1",
"service_offering": "",
"sys_class_name": "incident",
"closed_by": "",
"follow_up": "",
"parent_incident": "",
"sys_id": "4fec590f47b73110c238309bd36d43c2",
"contact_type": "",
"reopened_by": "",
"incident_state": "1",
"urgency": "3",
"problem_id": "",
"company": "",
"reassignment_count": "0",
"activity_due": "",
"assigned_to": "",
"severity": "3",
"comments": "",
"approval": "not requested",
"sla_due": "",
"comments_and_work_notes": "",
"due_date": "",
"sys_mod_count": "1",
"reopen_count": "0",
"sys_tags": "",
"escalation": "0",
"upon_approval": "proceed",
"correlation_id": "",
"location": "",
"category": "inquiry"
}]
}
Example of using 'httpClient' in AZURE
The following call gets information about work items.
Call:
httpClient.get("/" + workItem.project.getName()+"/"+"_apis/wit/workitems/"+workItem.key+"?api-version=5.1", false)
Response:
{
"id": 55,
"rev": 3,
"fields": {},
"relations": [{
"rel": "System.LinkTypes.Hierarchy-Forward",
"url": "https://dev.azure.com/{organization}/a4d886e0-19c9-4340-91c9-c7342ad4dc1c/_apis/wit/workItems/56",
"attributes": {
"isLocked": false,
"name": "Child"
}
},
{
"rel": "AttachedFile",
"url": "https://dev.azure.com/{organization}/a4d886e0-19c9-4340-91c9-c7342ad4dc1c/_apis/wit/attachments/f8385fba-64b5-44c2-900b-bb62f4cfa410",
"attributes": {
"authorizedDate": "2024-01-19T07:09:22.743Z",
"id": 4007203,
"resourceCreatedDate": "2024-01-19T07:09:22.743Z",
"resourceModifiedDate": "2024-01-19T07:09:22.743Z",
"revisedDate": "9999-01-01T00:00:00Z",
"resourceSize": 292869,
"name": "IMG_0011.jpeg"
}
}
],
"commentVersionRef": {
"commentId": 8517374,
"version": 1,
"url": "https://dev.azure.com/{organization}/a4d886e0-19c9-4340-91c9-c7342ad4dc1c/_apis/wit/workItems/55/comments/8517374/versions/1"
},
"_links": {
"self": {
"href": "https://dev.azure.com/{organization}/a4d886e0-19c9-4340-91c9-c7342ad4dc1c/_apis/wit/workItems/55"
},
"workItemUpdates": {
"href": "https://dev.azure.com/{organization}/a4d886e0-19c9-4340-91c9-c7342ad4dc1c/_apis/wit/workItems/55/updates"
},
"workItemRevisions": {
"href": "https://dev.azure.com/{organization}/a4d886e0-19c9-4340-91c9-c7342ad4dc1c/_apis/wit/workItems/55/revisions"
},
"workItemComments": {
"href": "https://dev.azure.com/{organization}/a4d886e0-19c9-4340-91c9-c7342ad4dc1c/_apis/wit/workItems/55/comments"
},
"html": {
"href": " "“
},
"workItemType": {
"href": "https://dev.azure.com/{organization}/a4d886e0-19c9-4340-91c9-c7342ad4dc1c/_apis/wit/workItemTypes/Task"
},
"fields": {
"href": "https://dev.azure.com/{organization}/a4d886e0-19c9-4340-91c9-c7342ad4dc1c/_apis/wit/fields"
}
},
"url": "https://dev.azure.com/{organization}/a4d886e0-19c9-4340-91c9-c7342ad4dc1c/_apis/wit/workItems/55"
}