Home > Blockchain >  how to pass date parameter in a rest request query in python: sysparm_query
how to pass date parameter in a rest request query in python: sysparm_query

Time:11-24

what is the best way to filter a rest request by date?

would work passing a variable maybe like this:

today = date.today() today_90 = today - timedelta(days = 90)

service-now.com/api/now/table/incident?sysparm_limit=1000&sysparm_query=sys_created_on**dates values here?**

CodePudding user response:

I try to understanding your problem:

from datetime import date, timedelta
import requests

today = date.today() 
today_90 = today - timedelta(days = 90)


r = requests.get('https://xxxx.service-now.com/api/now/table/incident?sysparm_limit=1000&sysparm_query=sys_created_on>'   str(today_90)   '&sysparm_query=sys_created_on<'   str(today))

  • Related