I'm using Microsoft's sample Django app and trying to read calendar events from now back to 1 year ago. The API request is done using Python Request functions:
response = requests.get(url, headers = headers, params = parameters)
Header is standard API request related:
headers = { 'User-Agent' : 'python_events/1.0',
'Authorization' : 'Bearer {0}'.format(token),
'Accept' : 'application/json',
'X-AnchorMailbox' : user_email }
And, for parameters I'm passing:
query_parameters = {'$top': '2500',
'$select': 'Id,Subject,Start,End',
'$orderby': 'Start/DateTime ASC'}
Now, I tried to define start and end dates as:
now = datetime.utcnow()
one_year = now - timedelta(days=365)
now = now.isoformat()
one_year = one_year.isoformat()
Then, tried to insert startDateTime and endDateTime parameters in the same query_parameters dict:
query_parameters = {'$top': '2500',
'$select': 'Id,Subject,Start,End',
'$orderby': 'Start/DateTime ASC',
'startDateTime' : one_year,
'endDateTime': now
}
I'm still getting event dumps from before a year ago. What am I doing wrong here? Is query_parameters the right place to insert start and end date and times?
url
? – Jason Johnston