System Parameters on REST calls

akennedy
Kilo Explorer

Hello all,

 

I'm attempting to use the table API to retrieve users based on their username. According to this article, it appears to suggest I can add a query parameter that looks like "sysparm_query=active=true" to the end of a GET call to filter the users I get back. I've modified the query parameter I'm using to "sysparm_query=user_name=<some username>" but it doesn't seem to be filtering properly. Am I forming the query parameter wrong or am I overlooking something else?

 

Thanks for your time,

-Andrew Kennedy

1 ACCEPTED SOLUTION

amadosierra
Kilo Guru

Hi Andrew,



I was able to filter by user name, the way you have attempted, with no problem. This is the full URL I used to retrieve the admin user's details:


https://<instance_name>.service-now.com/api/now/v1/table/sys_user?sysparm_query=user_name=admin



Just replace <instance_name> with yours and give it a try.



/Amado


View solution in original post

3 REPLIES 3

amadosierra
Kilo Guru

Hi Andrew,



I was able to filter by user name, the way you have attempted, with no problem. This is the full URL I used to retrieve the admin user's details:


https://<instance_name>.service-now.com/api/now/v1/table/sys_user?sysparm_query=user_name=admin



Just replace <instance_name> with yours and give it a try.



/Amado


Mike Allen
Mega Sage

I was able to get a record using this:



http://<instance>/api/now/v1/table/sys_user?sysparm_query=user_name=<username>


akennedy
Kilo Explorer

Thanks everyone, turns out I wasn't spelling "sysparm_query" correctly, instead I was using "sysparam_query". Thanks again for your help.