0

I am new to constructing Rest API GET queries.

Need help in GET request of Rest API by passing the fields in sysparm_fields.

I trying to query a Table via Rest API URI by passing only a limited number of columns of the table using Sysparam_fields.

However few column names have Spaces and parenthesis in it. So the JSON result set is excluding those columns and respective data when I do a GET request.

So if I am querying with column names "assigned_to (need the empid)" and "Number", I only get "Number" data.

If I dont pass, sysparm_fields it is returning the result set with all the columns including "assigned_to (need the empid)"

My end point looks like this

https://MyInstance.service-now.com/api/now/table/ticket?sysparm_exclude_reference_link=true&sysparm_fields=number,assigned_to (need the empid)&sysparm_query=sys_updated_onBETWEENjavascript:gs.dateGenerate('2020-09-01','00:00:00')@javascript:gs.dateGenerate('2020-09-01','23:59:59')

The result is only

{
    "result": [
        {
            "number": "TK00001"
        }
}

If my URI is

https://MyInstance.service-now.com/api/now/table/ticket?sysparm_exclude_reference_link=true&sysparm_query=sys_updated_onBETWEENjavascript:gs.dateGenerate('2020-09-01','00:00:00')@javascript:gs.dateGenerate('2020-09-01','23:59:59')

Then I get the result

{
    "result": [
        {
            "number": "TK00001",
            "assigned_to (need the empid)":"MYQ001",
            "Other_Field1":"Other Value 1",
             : 
             "Other_FieldN":"Other Value N"
        }
}

So how do I pass the column names that has Spaces and parenthesis like "assigned_to (need the empid)"

Thanks for the Help in Advance

Sathya
  • 29
  • 1
  • 8

0 Answers0