External REST API GET request from SNOW tables with query (sysparm?) in URL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-29-2018 06:44 PM
I am building a chatbot for new employees to help them navigate the onboarding process and take this burden off of HR specialists.
The bot takes user inputs and needs to send API GET requests to SNOW tables using those inputs in order to respond to the user with the information they need.
For example, user asks (for the sake of this example), "what is my name" ? Bot asks "whats your emloyee number" in order to pull the benefits information the employee is asking for from hr_core_profile. That employee_number is part of the URL of the GET request (...sysparm=employee_number=...).
BUT, what if I want the SNOW response to be filtered on a reference field like "Manager" in hr core profile where the JSON response would be something like {"link":"http://...", "sys_id"="pe8ru20489fh2p498rh2o"}?
Is there any documentation on querying SNOW tables using the URL of a GET request and anything more advanced than string literals?
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2018 11:23 AM
Use REST API Explorer and add encoded query in sysparm_query filed and that should give you filtered results.
For manager you can add sysparm_fields=manager so the response will only have manager
you will have to parse JSON on your end to get the value you are looking for.
Doc - https://developer.servicenow.com/app.do#!/rest_api_doc?v=jakarta&id=c_TableAPI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2018 12:53 PM
So, Mike, when the field on which I am trying to filter is a reference to another table (for example, the REST API response JSON for a benefits record would contain an employee object "employee" : {"link": "<url>", "sys_id":"i984hr938hr3893urfwu98h4"}, and I want to filter on that sys_id), I am not seeing any documentation on how to write that as an encoded query. Any thoughts?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2018 01:02 PM
I don't think you can do that. You will have to make another call to that table to using sys_id from your response.