Get the total no of records via api for meta

Adithya Khurana
Tera Contributor

For table API, api/now/stats/tablename returns the total no of records.

For some fields like priority, impact, category, subcategory and etc in incidents. I don't find any direct table api to get the records. So i tried with /api/now/ui/meta/incident fetching the choices of each json.
But how will i get the total no of records for this ?

Sample ui/meta/incident:
"subcategory"
: {
"type": "choice",
"name": "subcategory",
"choices": [
{
"label": "-- None --",
"rawLabel": "-- None --",
"selected": false,
"missing": false,
"image": "",
"used": false,
"reference": false,
"value": ""
},

}

4 REPLIES 4

Adithya Khurana
Tera Contributor

Team, Kindly provide update on the posted query

OlaN
Giga Sage
Giga Sage

Hi,

Your question is unclear. What is it you want to do here?

Have you played around with the REST API explorer in ServiceNow?
It might help you get what you're after.

Adithya Khurana
Tera Contributor

Okay. Yeah i tried REST API explorer but i couldn't find any for my requirement.

For incidents there are some fields like channel , state , impact, urgency , priority, category , subcategory.
For getting these fields data, i have used the api - /api/now/ui/meta/incident.
How will i get the number of data in each field ? For instance i want to know the count of data under priority. 

image.png

 

Sorry, I'm still not following.

Are you interested in getting all records with a specific choice ?

If so, use the REST API Explorer to build a query from your requirements.

 

If you are interested in getting the valid choices, for example the Category choice, that data is stored in another table [sys_choice], you can examine the choices available by opening a record, and inspect the dictionary entry.

 

How to inspect Dictionary entry, right-click the field label.

configure-dictionary.png