how to get the status of the ticket in servcienow api

Phanikanth
Kilo Contributor

I have servicenow api, which will give state filed ,I want to get the status of the ticket ,whether it is closed/pending through api.I need to get state filed instead of value displaying want to get ticket status.

find_real_file.png

9 REPLIES 9

Mark Roethof
Tera Patron

Hi there,

So you are after the display value (label) instead of the value? Like:

find_real_file.png

You can achieve this by applying sysparm_display_value. Set it to true or all. So for example:

sysparm_display_value=all

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

Mark Roethof
Tera Patron

For example:
GET https://your-instance.service-now.com/api/now/table/incident?sysparm_display_value=all&sysparm_limit=1

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020-2022 ServiceNow Community MVP
2020-2022 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

Not applicable

Hi @Phanikanth ,

You can just add &sysparm_display_value=true  on your url which will give you display value 

ex: https://XXXXXX.service-now.com/api/now/table/incident?sysparm_query=active%3Dtrue&sysparm_display_value=true

 

you can set a query parameter using REST API Explorer named sysparm_display_value.

Value options are:

  • true returns display values for all of the fields.
  • false returns actual values from the database. If a value is not specified, this parameter defaults to false.
  • all returns both actual and display values.

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Ankur Bawiskar
Tera Patron

Hi,

to get choice label you can use the endpoint with parameter mentioned by Mark

Regards
Ankur