1
votes

I am using FileMaker to interact with the Google Calendar API. I have managed to authorize my app, get a list of user's calendars and a list of events in those calendars and details for those events. However, I am having trouble creating events.

I make the following HTTP POST request. Header: Content-Type : application/json, Authorization : Bearer access_token

https://www.googleapis.com/calendar/v3/calendars/**********@gmail.com/events?{"attachments":[{"fileUrl":""}],"attendees":[{"email":"***********@gmail.com"}],"end":{"dateTime":"2017-08-20T13:00:00-05:00"},"reminders":{"useDefault":true},"start":{"dateTime":"2017-08-20T12:00:00-05:00"},"summary":"Test Event"}

I receive the following JSON error response:

{
    "error": 
    {
        "errors": 
            [
                {
                    "domain": "global",
                    "reason": "required",
                    "message": "Missing end time."
                }
            ],
        "code": 400,
        "message": "Missing end time."
    }
}

It appears that this is a pretty common error that people run into. However it looks like most having this problem are using frameworks for which there are libraries that Google Calendar API supports. I've tried to pick out the fix from some of the posts on stackoverflow and elsewhere concerning these other frameworks and apply them to my FileMaker / HTTP GET/POST setup to no avail.

Any help greatly appreciated!

2
Did you ever figure this out? I am having the same problem building my own http request. - DazedAndConfused

2 Answers

1
votes

Try using this instead.

POST https://www.googleapis.com/calendar/v3/calendars/calendarId/events

And supply the calendarId according to what the parameter requires

Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword.

0
votes

Use this

curl --location --request POST 'https://www.googleapis.com/calendar/v3/calendars/{email}/events' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {access_token}' \
--header 'Content-Type: text/plain' \
--data-raw '{`enter code here`
  "summary": "Google I/O 2015",
  "location": "800 Howard St., San Francisco, CA 94103",
  "description": "A chance to hear more about Google'\''s developer products.",
  "start": {
    "dateTime": "2015-05-28T09:00:00-07:00",
    "timeZone": "America/Los_Angeles"},
  "end": {
    "dateTime": "2015-05-28T17:00:00-07:00",
    "timeZone": "America/Los_Angeles"
  },
  "recurrence": [
    "RRULE:FREQ=DAILY;COUNT=2"
  ],
  "attendees": [
    {"email": "[email protected]"},
    {"email": "[email protected]"}
  ],
  "reminders": {
    "useDefault": false,
    "overrides": [
      {"method": "email", "minutes": 24},
      {"method": "popup", "minutes": 10}
    ]
  }
}'