Querying for endpoint fields - REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 12:06 PM
Hey all,
I'm working on a REST api integration and I'm having trouble finding a way to programmatically find the fields that are to be expected by a particular endpoint.
Is there a way perform a query, such that, I could make a call to an endpoint similar to:
Then, in response, get a list of the fields (and hopefully field datatypes) that this will return.
I've seen this referred to as a "describe" request elsewhere.
Thank you!
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 12:14 PM
Mention the fields in sysparm_fields query string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 12:35 PM
Ah - Thanks sorry.
I made that a bit unclear.
What I meant is... Is there a way to find out what fields the request:
GET https://dev43415.service-now.com/api/now/table/sys_user
will return?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 12:38 PM
As you know table API will return all fields in that table .Are you expecting columns under a table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2017 12:51 PM
An example would be retrieving the name of the response results fields for this endpoint.
https://developer.servicenow.com/app.do#!/rest_api_doc?v=jakarta&id=r_TableAPI-GET
So if the endpoint response is:
"result": [
{
"parent": "",
"made_sla": "true",
"watch_list": ""
I would want a list of "parent, made_sla, watch_list" and maybe the field data types.