How to “Add guest” to event via google calendar API?

You can use the API to add people to the attendees collection:

https://developers.google.com/google-apps/calendar/v3/reference/events/update

As Claudio mentioned, you need to use the Google Calendar Advanced API for this.

You'll want to use a patch because you don't want to replace all the other data on the calendar invite. However, even in the case of patch, since the attendees lives in an array, if you attempt to pass a patch such as this:

{
  attendees: [ { email: "[email protected]"} ]
}

... it'll replace all old invitees (i.e. it'll remove anyone that was on the invite before you called patch). To fix this, you must first get the current invitees, add a new person to the array, and then send a patch.

You can see a detailed example of this in this answer which also explains how to use Google Apps Scripting to ensure an email is sent to the user when adding them to a calendar event (see the addGuestAndSendEmail() method in that post).

refer the following request.

method: POST

endpoint: https://www.googleapis.com/calendar/v3/calendars/primary/events?sendUpdates=all

here, sendUpdates means when you add any guest so he would get an invitation mail used based on scenario.

Input Json: { "kind": "calendar#event", "etag": "etag", "status": "confirmed", "summary": "JayKara", "description": "eqwbdjhwhhwhhwrhjehrhejhfj", "location": "America", "creator": { "email": "@mail.com", "self": true }, "organizer": { "email": "@mail.com", "self": true }, "start": { "date": "2019-12-23" }, "end": { "date": "2019-12-24" }, "originalStartTime": { "date": "2019-12-24" }, "visibility": "public", "attendees": [ { "email": "****@mail.com" //this guys are the guest } ] }.

After that there is no patch method required your guest guys will receive an invitation whenever update event

Cheers!