Resolving a problem ticket via REST API - Resolution code error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 02:14 PM
Hi!
Here is my curl example
curl -X PATCH "https://api/now/table/problem/bd27af94c3bb12104fcb1933e40131a6" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--user "admin:password" \
--data '{
"problem_state": "107",
"active": "false",
"assigned_to": "6816f79cc0a8016401c5a33be04be441",
"resolution_code": "fix_applied",
"resolved_by": "6816f79cc0a8016401c5a33be04be441",
"resolved_at": "2025-02-14 22:30:00",
"resolution_notes": "Enabled the Ethernet0/0.10 interface on Router R1, restoring connectivity between PC1 and PC2. Evidence: Successful ping test from PC1 to PC2 with 0% packet loss.",
"close_notes": "Problem resolved successfully.",
"work_notes": "Closing issue: Enabled Ethernet0/0.10 on Router R1, PC1 to PC2 connectivity restored."
}'
when I curl to get valid resolution codes fix_applied seems valid but I get this error:
{"error":{"message":"Operation Failed","detail":"Data Policy Exception: \n\tThe following fields are mandatory: Resolution code"},"status":"failure"}
What am I doing wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2025 09:55 AM
Hello @automateyournet ,
There are Data Policies in ServiceNow, which run on the Server Side.
From the error it shows that, you are Resolving the Incident, but the DataPolicy tells that to Resolve a Ticket, you must Resolution Code which is Mandatory.
URL: <...............>service-now.com/nav_to.do?uri=sys_data_policy2.do?sys_id=e1ad84af875b13000e3dd61e36cb0b72
Adding the below line will do the job.
"resolution_code": "fix_applied"
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.