REAST API call for latest ticket for a given assignment group

jonmuni
Kilo Contributor

Hi guys,

I am automating ticket creation for badge scans and am looking to create a REST api call to query for the incident number with a user name variable ( powershell )

Essentially, what happens is the ticket gets created and I then want to send back a response with the user name (which is variable) and inc number.

Can anyone help?

thanks!

jon

6 REPLIES 6

Chuck Tomasi
Tera Patron

Hi Jon,



Using the table API, you'll get a response back with the details of the new record. I invite you to use the REST API Explorer to test it out.



Getting Started with REST - ServiceNow Wiki


REST API Explorer - ServiceNow Wiki


REST API  


Hi Chuck,



I am using the api explorer but am at a loss. I have the response but not the latest ticket created for a given user for "today".



What am I missing?





Cheers!



Jon


I thought you were using REST to create a record?


the ticket gets created and I then want to send back a response with the user name (which is variable) and inc number



That information is passed back as part of the REST response when you create a record. If you want the display values (e.g. user name) then add this to the URI when the record is created (using the POST).



sysparm_display_value=true


Hi Chuck,



I am, this is the second phase which is to display a confirmation with the ticket number and "requested for" attribute.



here is the url:


mysite.service-now.com/api/now/table/incident?sysparm_query=state%3D0%5Esys_created_onONToday%40javascript%3Ags.daysAgoStart(0)%40javascript%3Ags.daysAgoEnd(0)&sysparm_display_value=true&sysparm_exclude_reference_link=true&sysparm_suppress_pagination_header=&sysparm_fields=number%2Cu_requested_for&sysparm_limit=1&sysparm_view=



Jon