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

MrMuhammad
Giga Sage

HI,

I believe that is not possible with Servicenow APIs. However, you might create your scripted Rest API to achieve this. 

I would also, like to know the use case for getting the label instead of the column name. Can you explain that?

Regards,

Muhammad

Regards,
Muhammad

Tim McFadden
Kilo Contributor

Scripted REST API?

Seems like is should be possible as they do it in Azure Logic Appsfind_real_file.png

I am building an app in C# that sends tickets to ServiceNow.  I want the user to have dropdown like this of all the fields they are using in ServiceNow.  So they can map data to those fields.

 

HI

You can do so when you query the Dictionary table (via REST API) and find table field names and labels on that table [sys_dictionary].

Let me know if that answers your question and mark my answer as correct and helpful.

BR

Dirk

 

Harika Bhupathi
Giga Guru

Hi,

try below 

Online application to test the API

https://reqbin.com/

 

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

 

In Reqbin give the endpoint and credentials of a user from your instance , you can see the response on the right side of the screenshot.

find_real_file.png

 

Please do mark my answer as Correct/Helpful  if it helped you to resolve the issue.

 

Regards,

Harika