user3747497
user3747497

Reputation: 21

Google calender Api date filter not working in apex

I am trying to fetch data only which resides on particular dates.I am using this api-: https://www.googleapis.com/calendar/v3/calendars/primary/events&timeMin=2021-10-25T10:00:00-07:00&timeMax=2021-10-28T10:00:00-07:00&timeZone=America/Los_Angeles but this is not working.I am using apex so don't have library support.

Upvotes: 0

Views: 106

Answers (1)

Tanaike
Tanaike

Reputation: 201418

When I saw your URL, I thought that when the query parameter is added, it is required to modify from /events&timeMin= to /events?timeMin=. So how about the following modification?

Modified URL:

https://www.googleapis.com/calendar/v3/calendars/primary/events?timeMin=2021-10-25T10:00:00-07:00&timeMax=2021-10-28T10:00:00-07:00&timeZone=America/Los_Angeles
  • In this case, when the calendar is publicly shared, you can use this endpoint with the API key. When the calendar is not publicly shared, please use the access token retrieved by the OAuth2 and the service account.
  • And, I'm worried that you might be required to use by converting the above URL by the URL encoding. At that time, please test this. https://www.googleapis.com/calendar/v3/calendars/primary/events?timeMax=2021-10-28T10%3A00%3A00-07%3A00&timeMin=2021-10-25T10%3A00%3A00-07%3A00&timeZone=America%2FLos_Angeles

Reference:

Upvotes: 1

Related Questions