Filters in REST calls?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2022 04:28 AM
How do you set up a filter in the Query Parameter section of a REST Data Source Request? I've got a connection to a SQL Server database that works fine to pull all of the records in the table, but I need to limit that. I haven't been able to figure out how to construct the filter for the REST call. Any help would be greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2022 06:10 AM
Hi,
you can use the SQL statement and add the filter to get the unique data and refer below screen shot.
Example:
SELECT
it.ITEMID AS ItemNumber,
ISNULL(cidc.CUSTOMERDESCRIPTIONID, '') AS DescriptionID,
ISNULL(cidc.[DESCRIPTION], '') AS ShortDescription
FROM INVENTTABLE it
WHERE
it.DATAAREAID IN ('DUS')
AND it.MODIFIEDDATETIME >= convert(VARCHAR, getdate() - 2, 101)
as highlighted above it will get the last 2 days modified records.
you can condition something like this based on the source system data.
Hope it helps!!
Please Mark ✅ Correct/helpful, if applicable, Thanks!!
Regards
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 07:27 AM
Hi,
Please close the thread and Mark ✅ Correct/helpful.
or Let me know if you are looking for anything else.
Thanks,
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2022 10:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2022 12:36 AM
Hi,
My apologies, I understood you are requirement differently.
May below articles help you out.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0831528
https://community.servicenow.com/community?id=community_question&sys_id=f090120edb2414105129a851ca9619f5
https://developer.servicenow.com/print_page.do?release=rome&category=learning-module&identifier=app_store_learnv2_rest_rome_cors_rules,servicenow_application_developer&module=learning%20plan
Thanks,
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar