Getting activity log of specific incident through the REST API

mahadevanswamy
Kilo Explorer

I would like to know how to get the activity log of a specific incident through the REST API. I have looked at a similar post in this forums and it didn't help me out. I am using Service NOW Helsinki. Please let me know the table name by which I can get the activity logs of a specific incident.

Thanks in advance,

Swamy

19 REPLIES 19

Use the navigation filter at the top left and type



sys_history_line.list



find_real_file.png



Once on the list, you can use Configure> Dictionary to see the table structure. The "set" field is your reference to which incident you want. You'll need to specify which set you want on your URL something like



https://INSTANCENAME.service-now.com/...?sysparm_query=set=SYS_ID_OF_INCIDENT


I tried querying an active incident in service now by the sys_id and no results were returned. I am able to get a lot of records through the query but I am having a hard time understanding the response results. I just want to see the activity log of an incident in Service Now. Unfortunately, I do not have admin rights to service now as I am consuming the client api to get some information.


I believe you need to do this in two steps. Step 1 is get the sys_id of the incident you want. If you don't already have it, then you need to send a REST GET to the table API. If you have something like the number (e.g. INC0010004) you can do a sysparm_query=number=INC0010004 and it will return the sys_id in the response.



Once you have that, make your second call to the sys_history_line table with something like sysparm_query=set=(INCIDENT_SYS_ID) - sys_id from the other query.



Hope that helps.


ok for the first step, can you tell me from which table I can get the sys_id for the incident that I want to query?


I got the sys id of the incident record and tried to query the sys_history_line table using that sys_id and no results were returned.