Get Column Label Names for Incident Table with Rest API

Tim McFadden
Kilo Contributor

How do I query the rest API for Column Label Names?  I can query one incident to get all the columns like this.

https://myDev.service-now.com/api/now/v1/table/incident?sysparm_limit=1

find_real_file.png

 

But I need to get all the labels for each of the columns

find_real_file.png

1 ACCEPTED SOLUTION

John VanBruggen
Giga Guru

You can use this and it will get all the fields from incident and task.

Incident extends task so it also inherits all the fields from task.

https://{INSTANCENAME}.service-now.com/api/now/table/sys_dictionary?sysparm_query=name%3Dincident%5EORname%3Dtask&sysparm_fields=column_label

Check out my Consultant's Survival Guide
https://youtube.com/watch?v=zYi8KhP9SUk

View solution in original post

19 REPLIES 19

Hi Harika,

This seems to be exactly what I am looking for but doesn't return all fields.

The query provided only returns 21 fields.  The incident has 88 fields

 

find_real_file.png

 

Can you possible help to return all 88 fields?  What does %3D do in the query?

Hi Tim,

 

Try this endpoint URL to get all the fields

https://demo1.service-now.com/api/now/table/sys_dictionary?sysparm_query=name%3Dincident%5EORname%3Dtask&sysparm_fields=column_label

 

Since some the dictionary fields are from task table, above endpoint URL gives you the fields from incidents and task as well.

 

In the URL - %3D and %5E are URL encodings

URL-encode        ASCII Value

%3D                     =

 

Refer below link to know about URL encodes

https://www.eso.org/~ndelmott/url_encode.html     

 

Please do mark my reply as correct or helpful, if it helped you resolve the issue 🙂

 

Regards,

Harika                

 

@Tim McFadden 

few of the fields might be at task level hence it won't give you those fields when you use incident table in your API for dictionary

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

This is spot on.

Check out my Consultant's Survival Guide
https://youtube.com/watch?v=zYi8KhP9SUk

Ankur Bawiskar
Tera Patron
Tera Patron

@Tim McFadden 

Not possible to get using the OOB Table API on incident.

What is the client requirement for this

Approaches

1) Either use table API on the Dictionary table to get the list of columns for incident

OR

2) Use scripted rest api to return the Column Label and it's value by forming custom json response

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader