- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 03:27 AM
Hi All,
I am trying to read the variable values from a requested item using REST API. I queried the table "sc_item_option_mtom" with the below context.
sc_item_option_mtom.request_item=<<sys_Id of the corresponding RITM>>
The output response from postman looked something like below:
{
"result": [
{},
{},
{},
{},
{}
]
}
What does this response mean? What is the mistake that am making here? I would like to capture the values of the custom variables in a request item.
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 12:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 03:46 AM
Please update "sysparm_display_value" to true in REST API Explorer.
Note: Table level API is ok if you are planning to use this API for only one catalog item with limited fields/variables to retreive.
If you configure a scripted rest API, you can leverage it for all request items which is a more stable and configurable solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 12:09 AM
Hi Akshaya,
As I have understood you would like to get all the variables from a single RITM. If you would like to make a generic solution, not just a quick one-time use only, I would go with Scripted REST APIs, there's a great guide for that here:
SN Pro Tips — Scripted REST APIs & Retrieving RITM Variables via SRAPI
Also, the issue in your request would be a missing .sys_id parameter.
Instead of querying request_item=RITMID, query request_item.sys_id=RITMID. This should yield the results you are looking for. Full link would look like this, assuming that you are using the table API:
INSTANCE/api/now/table/sc_item_option_mtom?sysparm_query=request_item.sys_id%3D[RITMID]
Hope I could help!
Best Regards.
István