- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2016 10:22 AM
I'm trying to create a REST GET query using the sysparm_query parameter matching a subset of a field name, e.g.
to match all records in cmdb_ci_server where the OS has 'Windows' in it. Obviously this doesn't work.
However, if I search for the full name, e.g.
...&os=Windows 2012 Datacenter
it matches correctly, but in this case I'm trying to match all versions of Windows.
Is there a way to do this? Or would I better off to pull down all records and filter them client side?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2016 10:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2016 10:41 AM
cmdb_ci_server?sysparm_query=osCONTAINSwindows
Gave me 19 results in PowerShell. I went into the table in the application and, sure enough, I had 19 servers that osCONTAINSwindows.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2016 10:45 AM
Also, cmdb_ci_server?sysparm_query=osLIKEwindows worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2016 11:07 AM
This works, thanks!
Only problem is I can't figure out how to do multiple queries, e.g. 'osCONTAINSWindows&cpu_nameCONTAINSamd'
I can do a simple equals, e.g. 'osCONTAINSWindows&cpu_count=2' but I can't figure out how to do multiple CONTAINS or LIKE filters.
Do you know if there is any better documentation on constructing REST queries than the 'Table API' document?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2016 11:16 AM
There is stuff on the developers site: ServiceNow Developers
Maybe something is different here in Geneva-docs: Table API
The best way to construct your query, though, is to go in the tool and construct it in the application.