What did I do wrong with this API call? (create an event in Google Calendar)

I mad this call to create event in Google Calendar that contain a Google Meet link, but I still not able to figure out where is the mistake I made

Body:

{
  "start": {
    "dateTime": <StartDateTime>,
    "timeZone": <timeZone>
  },
        
  "end": {
    "dateTime": <EndDateTime>,
    "timeZone": <timeZone>
  }, 
        
  "attendees": [
    {
      "email": <AttendeeEmail>,
      "responseStatus": <AttendeeResponseStatus>
    }
  ],
        
  "conferenceData": {
    "createRequest": {
      "requestId": <ConferenceRequestId>,
      "conferenceSolutionKey": {
        "type": <ConferenceType>
      }
      }
    }
}

1 Like

What’s the mistake?

I get this when I initialize:

The first thing is there a lot of double quotes missing around values (probably all of them). Also, do you have content type header

This video helped me alot

I putted < > instead of " " in the pody so I can insert the value in the input instead of the body.
Also I don’t have content type header since json is what google expect to send.

I used oauth2 user-agent flow authntication method which is better than his way in setting the API. However, I’ve watched his other videos about calls but couldn’t figure out where I went wrong with this call

Yes, but by default Bubble, even if you select JSON, will not include this header. You need to include Content-type header with value to application/json
You need to keep <> to have dynamic field, but the value need to be surrounded by double quotes.
you can add them to the body or to the value, it’s doesn’t matter

Actually, the error you get is not related to auth, but to payload. 400 error is a bad request. If you get 401 error, this will be related to auth or scopes.

I have surrounded the value by double quotes and now it work, thank you very much, and it worked without including Content-type in the header.

1 Like

Can you share me how you found to use or how to set up the oauth2 user-agent flow?

The channel that you shared one of its videos contains a video that deals with this method, but it is not sufficiently clear. I also found a video of Bubble that deals with this method in a better amount of detail:

However, I struggled until I was able to set the correct settings for Google Calendar, and these are the settings that work now for me:

1 Like