- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 11:53 AM - edited 05-04-2023 11:54 AM
How can I make a rest API call to query a record based on a query parameter that is not exact match but one of the values in a set?
e.g GET /api/now/table/user?sysparm_query=name(is one of)"value1,value2,balue3"
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 07:09 PM
Hi,
To make a REST API call to query a record based on a query parameter that is not an exact match but one of the values in a set, you can use the "IN" operator in the query parameter.
Here's an example REST API call to retrieve users whose name is one of "value1", "value2", or "value3":
GET /api/now/table/user?sysparm_query=nameINvalue1,value2,value3
The "IN" operator allows you to specify a comma-separated list of values to search for. In this example, the "nameIN" parameter is used to search for users whose names are one of the specified values.
Note that you do not need to enclose the values in quotes as the values are comma-separated. Additionally, you can use other operators such as "!=" or ">" to perform more complex queries.
Also, keep in mind that the "sysparm_query" parameter is case-sensitive, so make sure to use the correct case for the field name and operator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2023 07:09 PM
Hi,
To make a REST API call to query a record based on a query parameter that is not an exact match but one of the values in a set, you can use the "IN" operator in the query parameter.
Here's an example REST API call to retrieve users whose name is one of "value1", "value2", or "value3":
GET /api/now/table/user?sysparm_query=nameINvalue1,value2,value3
The "IN" operator allows you to specify a comma-separated list of values to search for. In this example, the "nameIN" parameter is used to search for users whose names are one of the specified values.
Note that you do not need to enclose the values in quotes as the values are comma-separated. Additionally, you can use other operators such as "!=" or ">" to perform more complex queries.
Also, keep in mind that the "sysparm_query" parameter is case-sensitive, so make sure to use the correct case for the field name and operator.