change assessment via API

rkbehera080
Tera Contributor

Hello,

 

I have a requirement where the customer want to do the change risk assessment via API.

Can anyone please guide me how to achieve this ?

 

Thanks in Advance

2 REPLIES 2

Dr Atul - LNG
Tera Patron

Hi @rkbehera080 

 

https://www.servicenow.com/community/developer-forum/risk-assessment-ap/m-p/2519750

 

The Risk Assessment data for a Change Request can be accessed via the REST API using the Table API. You can use the Change Request API (change_request table) and the Risk Assessment API (asmt_assessment_instance table) to retrieve or update risk assessment data.

 

  1. ServiceNow REST API for Risk Assessment in Change Requests
  2. Retrieve Risk Assessment for a Change Request

To get the risk assessment data for a specific change request, you can query the assessment instance linked to the change request.

API Endpoint:

GET https://your-instance.service-now.com/api/now/table/asmt_assessment_instance?sysparm_query=source=ch...

  • This API retrieves assessment instances related to change requests.
  • You can modify the query to filter for specific change records.

Example cURL Request:

curl -X GET "https://your-instance.service-now.com/api/now/table/asmt_assessment_instance?sysparm_query=source=ch..." \
--header "Accept: application/json" \
--header "Authorization: Basic YOUR_CREDENTIALS"

 

  1. Get Risk Assessment from the Change Request Table

You can also directly query the change_request table and retrieve the risk level field.

API Endpoint:

GET https://your-instance.service-now.com/api/now/table/change_request?sysparm_fields=sys_id,number,risk...

  • This retrieves all change requests with risk level and impact values.

Example cURL Request:

curl -X GET "https://your-instance.service-now.com/api/now/table/change_request?sysparm_fields=sys_id,number,risk..." \
--header "Accept: application/json" \
--header "Authorization: Basic YOUR_CREDENTIALS"

 

  1. How to Find the API in ServiceNow?

If you want to discover available APIs in your ServiceNow instance:

 

 

  • Navigate to REST API Explorer

 

      • In ServiceNow, go to System Web Services > REST API Explorer.
      • Select Table API and choose the change_request or asmt_assessment_instance table.
      • Experiment with API calls and test responses.

 

  • Use API Documentation

 

    • Go to System Web Services > REST API Explorer > API Documentation.
    • Look for Table API or Assessment API to find specific endpoints.

 

  1. Create a Risk Assessment via API

To create a new risk assessment for a change request, send a POST request to the assessment instance table.

API Endpoint:

POST https://your-instance.service-now.com/api/now/table/asmt_assessment_instance

Example JSON Body:

{
  "source": "change_request",
  "source_id": "CHANGE_REQUEST_SYS_ID",
  "state": "in_progress",
  "due_date": "2025-03-01 12:00:00"
}

Summary:

  • Use the asmt_assessment_instance table to fetch risk assessment data.
  • Use the change_request table to get the risk level.
  • Use REST API Explorer in ServiceNow to test and find the right API.
  •  

Mark Manders
Tera Patron

We need more information than that. What is their exact requirement? 

Do they want to do it from a different system? Do you need to export the assessment and get the answers back, or is there a different system they want to put the answers in and do you need to map them back?