Querying for Dictionary Entries using REST interface

macmceldon
Kilo Contributor

Hi,

I'm trying to use the REST TABLE API (Fuji, Latest) to pull dictionary entries such as Priority, State etc. I can get access to the sys_dictionary table but not seeing how I get to the dictionaries within. Please help.

Thanks

MM

1 ACCEPTED SOLUTION

Hi MM,



If you want to retrieve all the categories for the incident table then you may want to query the sys_choice table where table is incident and element is category.



The query string will be something like: sysparm_query=nameSTARTSWITHincident%5EelementSTARTSWITHcategory



Thanks,


Berny


View solution in original post

7 REPLIES 7

joseeduardo
Giga Expert

hi Macmceldon, when you you are using a GET message of REST, you tipically recieve all of the fields within the table! for example:


if you use this rest link : https://<your instance>.service-now.com/api/now/table/incident   you will get all of the fields within incidents! you can also specify what fields to return like this:   https://dev12348.service-now.com/api/now/table/incident?sysparm_query=&sysparm_fields=priority (this will return only priority fields!) or if you want more fields at once use %2C after each condition like this:


https://<your instance>.service-now.com/api/now/table/incident?sysparm_query=&sysparm_fields=priority%2Clocation%2Curgency (to get priority, location and urgency)

now remeber I am not specifying any specific record on incidents table, so I would recieve all of the fields of all of the incidents! so you woul actually specify what incident you want using the following link https://<your instance>.service-now.com/api/now/table/incident/<sys id of the record you want to che... or you could simply check an incident record by https://<my instance>.service-now.com/api/now/table/incident/392c0e4f4fc19640d12b8c318110c7b4 last one was an example a record in my developer instance!


hopefully my answer solves your question!


You also may want to check out REST API EXPLOER, this is available for default in all instances here you can create many links and give you some good examples about REST and also it gives you code when you are trying to do REST but from servicenow! you should definetive look at it! REST API Explorer - ServiceNow Wiki


Jose - allow me to rephrase my original question; unfortunately your reply is not relevant to my need.



I need to iterate dictionary entries via the REST API - using Priority for example, I need to iterate the value, display value, link for Priority for any instance, targeting sys_dictionary I presume.



Thanks,



Mac


Hi Mac,



I am not sure what it is you are wanting to achieve - perhaps supply some more background?



System Dictionary - ServiceNow Wiki


1 . Overview


The system dictionary is a table, called Dictionary Entry [sys_dictionary], that contains details for each table and the definition for every column on each table in an instance. Each row in the system dictionary represents either a table or a column in one of the tables. The system dictionary provides options for administrators to modify tables and fields, which in turn define lists and forms.


Below there   is a query from sys_dictionary that identifies the tables that have a column called priority - what would you like to do next?



Best Regards


Tony






Screen Shot 2016-01-25 at 7.08.33 AM.JPG