Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

History of incident details in API

saravananperiy1
Kilo Explorer

Hi, I am new to service now API, Please help me to get the history of incident information in api. I have incident sys_Id. based on this data how do I get history of all the changes. I tried in sys_audit table but information is not available.

1 ACCEPTED SOLUTION

Raju Koyagura
Tera Guru

Go to the particular record you want to see the history right click on form header -> History -> List



find_real_file.png






find_real_file.png


View solution in original post

4 REPLIES 4

Raju Koyagura
Tera Guru

Go to the particular record you want to see the history right click on form header -> History -> List



find_real_file.png






find_real_file.png


Thanks Raju. I want to get the same information in REST API, Please help me to get the history of information in REST API.


Hi Sarvanan,



Re: How to get the incident history using REST API



The history is found in the sys_history_line table - where the id of the record in sys_history_line matches the sys_id of the TASK table - so in your use case the incident sys_id.



Along the lines of:


curl "https://instance_name.service-now.com/api/now/table/sys_history_line?sysparm_query=id=adee6624138903..."   --request GET   --header "Accept:application/json" --user 'admin':'admin'



returns:


{"result":[{"new":"(3)","set":{"link":"https://instance_name.service-now.com/api/now/table/sys_history_set/4dd4a04513950700125ad8228144b0da","value":"4dd4a04513950700125ad8228144b0da"},"old":"","user_name":"System Administrator","sys_mod_count":"","update":"0","label":"Review status","sys_updated_on":"","type":"","audit_sysid":"0","relation":"","sys_id":"01d4a04513950700125ad8228144b0dd","update_time":"2017-09-17 10:47:06","sys_updated_by":"","field":"review_status","user_id":"admin","sys_created_on":"2017-09-17 10:47:10","old_value":"","internal_checkpoint":"0","user":


...



If the reply was informational, please like, mark as helpful or mark as correct!