- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 12:23 AM
Hi,
I'm getting the wrong dates returned from the "incident" table using this url:
I was expecting to get only dates > 01-01-2023, however the first 1000 elements returned gives me dates from 2019.
I'm doing this in Postman whilst I get the syntax correct and the final application will be in C#.
e.g.
Can anyone please advise?
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 12:43 AM
Hi @thedavegray
How did you frame the query, I'm getting correct results with the below query.
https://company.service-now.com/api/now/table/incident?sysparm_query=sys_created_on%3Ejavascript%3Ag...
Approach to frame the query
Copy the query
REST API Explorer
Execute
This is the url for you
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 12:35 AM - edited 01-27-2023 12:43 AM
Hi @thedavegray ,
Can you please try the below URL and see if it works?
curl "https://company.service-now.com/api/now/table/incident?sysparm_query=sys_created_on%3E%3Djavascript%3Ags.dateGenerate('2023-01-01'%2C'00%3A00%3A00')&sysparm_limit=1000" \ --request GET \ --header "Accept:application/json" \ --user '':''
Mark helpful if it helps in solving your query.
Regards,
Johns
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 01:43 AM
I have never been able to get curl to work on our network for any url, not sure if it's blocked in some way, getting this error.
curl: (35) schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.
I tend to use Postman instead as this simply works with anything, including the date checking syntax you posted for curl. 😁
I understand that %3E%3D equals ">="
not really sure what "%3Ags" means though and a Google search is not helping.
That said, I wanted a range, e.g. date >= AND date <
and this syntax seems to work in Postman. 👍
sys_created_on%3E%3Djavascript%3Ags.
dateGenerate('2023-0123'%2C'00%3A00%3A00')^
sys_created_on%3Ejavascript%3Ags.dateGenerate('2023-01-12'%2C'00%3A00%3A00')
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 02:20 AM
Hi @thedavegray ,
The error message that you have mentioned is something to do with the Certificates. I would prefer to contact the network team for that issue.
And regarding %3Ags --> its %3A (which means ':') and gs is the function for the date generation. so in general its like javascript:gs.dateGenerate('').
Regards,
Johns

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 12:43 AM
Hi @thedavegray
How did you frame the query, I'm getting correct results with the below query.
https://company.service-now.com/api/now/table/incident?sysparm_query=sys_created_on%3Ejavascript%3Ag...
Approach to frame the query
Copy the query
REST API Explorer
Execute
This is the url for you
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.