REST API - Get the Input of user id and Pass the count of Assigned Tickets
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 07:23 AM
I have a requirement where I need to get the value of the user id as input outside of ServiceNow and send this value to ServiceNow using REST API to get the count of how many tickets assigned to this user id. Please let me know if anyone has done something like this or have some inputs.
- Labels:
-
Integrations
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 07:29 AM
Hi,
You can leverage Table API and make a get request by passing the sys_id of user to the task table. That will return you the tickets information in response. Give it a try in REST API Explorer.
Table API Refrence
https://developer.servicenow.com/dev.do#!/reference/api/orlando/rest/c_TableAPI#r_TableAPI-GETid
Rest Explorer API -https://docs.servicenow.com/bundle/orlando-application-development/page/integrate/inbound-rest/conce...
Let me know if you have any questions
Thanks & Regards,
Sharjeel
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 07:31 AM
Hi,
will this just be tasks that extend the task table or other tables? If the latter, it would be easier to create a scripted rest api.
Example using REST API Explorer
GET https://xxx.service-now.com/api/now/table/task?sysparm_query=assigned_to.user_id%3Dadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 07:33 AM
Hi Kieran,
Yeah it will be task and its extended tables. Is there a sample code for the scripted REST API that gets the count of tickets from the table when the assigned_to value is given as input.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2020 07:55 AM