REST API to fetch templates for case entity

shivamgargsya
Kilo Contributor

Hi

We are developing a application for service now heinieski version. For this app we want to retrieve all the Templates present for case replies.

Screen Shot 2017-10-05 at 2.42.33 AM.png

As highlihted in image. We want to know the REST API to retrieve all these templates or essentially the table name against which we have to make REST API call. I tried searching in REST API Explorer but did not found such table.

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Shivam,



sys_template is the table you need to query against. Here is the updated query



https://YOURINSTANCENAME.service-now.com/api/now/table/sys_template?sysparm_query=table%3Dincident&s...


View solution in original post

3 REPLIES 3

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Shivam,



sys_template is the table you need to query against. Here is the updated query



https://YOURINSTANCENAME.service-now.com/api/now/table/sys_template?sysparm_query=table%3Dincident&s...


Thanks Pradeep This worked for me. Also Pradeep can you tell us how can we retrieve which templates have been applied for a particular case like the case I have shown in screenshot when a rest call is make to retrieve the cases   ie


https://instance-name/api/now/table/sn_customerservice_case.

The following response is obtained


"result": [
  {
  "parent": "",
  "made_sla": "true",
  "caused_by": "",
  "watch_list": "",
  "upon_reject": "cancel",
  "sys_updated_on": "2017-10-04 20:14:56",
  "support_manager": "",
  "approval_history": "",
  "skills": "",
  "number": "CS0001002",
  "problem": "",
  "sys_updated_by": "admin",
  "opened_by": {
  "link": "https://instancename/api/now/table/sys_user/6816f79cc0a8016401c5a33be04be441",
  "value": "6816f79cc0a8016401c5a33be04be441"
  },
  "user_input": "",
  "sys_created_on": "2017-09-29 15:41:39",
  "contact": "",
  "sys_domain": {
  "link": "https://instancename/api/now/table/sys_user_group/global",
  "value": "global"
  },
  "state": "1",
  "case": "CS0001002",
  "sys_created_by": "admin",
  "knowledge": "false",
  "order": "",
  "closed_at": "",
  "cmdb_ci": "",
  "delivery_plan": "",
  "contract": "",
  "impact": "3",
  "active": "true",
  "work_notes_list": "",
  "business_service": "",
  "entitlement": "",
  "priority": "4",
  "sys_domain_path": "/",
  "time_worked": "",
  "expected_start": "",
  "opened_at": "2017-09-29 15:41:19",
  "business_duration": "",
  "first_response_time": "",
  "group_list": "",
  "work_end": "",
  "approval_set": "",
  "subcategory": "0",
  "work_notes": "",
  "short_description": "",
  "correlation_display": "",
  "delivery_task": "",
  "work_start": "",
  "assignment_group": "",
  "additional_assignee_list": "",
  "description": "",
  "calendar_duration": "",
  "close_notes": "",
  "notify": "1",
  "sys_class_name": "sn_customerservice_case",
  "closed_by": "",
  "follow_up": "",
  "sys_id": "833b97780f2103000f5d3e4ce1050e05",
  "contact_type": "web",
  "urgency": "3",
  "company": "",
  "reassignment_count": "0",
  "activity_due": "",
  "assigned_to": "",
  "product": "",
  "comments": "",
  "approval": "not requested",
  "sla_due": "",
  "change": "",
  "comments_and_work_notes": "",
  "due_date": "",
  "sys_mod_count": "2",
  "sys_tags": "",
  "partner": "",
  "escalation": "0",
  "upon_approval": "proceed",
  "partner_contact": "",
  "correlation_id": "",
  "location": "",
  "asset": "",
  "category": "1",
  "account": ""
  }
  ]


it does not have reference to the templates applied over this case. I have applied template2 and template5 in it as shown in screenshot