Filter the api response using Sysparm_query for nested JSONObject

Adithya Khurana
Tera Contributor

Hello,
Is there a way to filter the response using sysparm_query, i want the role to be itil & the provided user id.
I tried the below query but it doesn't work. could you please help.

role.display_value=itil^user.value=

b6b364e253131300e321ddeeff7b121b


Response :

{
"role": {
             "display_value": "knowledge_manager",
            "value": "f8bfbd02eb202100216a87b9d106fe92"
},
"user": {
              "display_value": "Problem Manager",
              "value": "d3dbbf173b331300ad3cc9bb34efc466"
}
},

 

 

 

shaunthesheep_0-1689941993776.png

 

 

1 ACCEPTED SOLUTION

Community Alums
Not applicable

@Adithya Khurana ,

No need to use role.display_value and user.value.

you can filter by 

sysparm_query: role=(sys_id of itil role)^user=(sys_id of user).

It's working as desired

View solution in original post

8 REPLIES 8

Adithya Khurana
Tera Contributor

yeah i understood, for single key value pair i am able to query. 

API Response :

{"result": {
"calendar_integration": "1",
"country": "",
"user_password": "74R17ry2kM"
}}


Key : sysparm_query
Value : user_password=74R17ry2kM

How to query for the nested object ? (what value should be passed )

API Response :  ( I want to get the result of role that has display value = "knowledge manager")

"result": [

{
"role": {
             "display_value": "knowledge_manager",
             "value": "f8bfbd02eb202100216a87b9d106fe92"
      }
},

key : sysparm_query
value : ?????

Adithya Khurana
Tera Contributor

Team, Could anyone provide update on this please

Community Alums
Not applicable

Hi @Adithya Khurana ,

Do you want to acheive this in Postman ?

yes like external API Call