How to create google resource calendar using any API? - google-api

I'm looking for a way to create resource calendars for shared rooms and for booking using any google API. In google documentation, it is mentioned that:
The Calendar API does not offer a way to create resource calendars. To do this, you need to use the Directory API's Calendar Resource object.
But the link mentioned refers to the creating calendar resource, not resource calendar!

Think of a resource room more like a user.
You can book resources and rooms by adding them to events as attendees, using their email address. When they receive the invitation, they automatically accept or decline the event based on the availability and access right of the inviting user.
Its not really a calendar. By adding the resource as an attendee for an event you are booking that room.

Related

How to set available and unavailable times for a google resource for booking?

I'm looking for a way to set time availability and unavailability of the google calendar resources.
At the moment, I could create google calendar resource with google admin api. But the problem is, I don't know how to set available time for them that could use in booking process — creating an event in google calendar, and assign a resource to that event.
There's no any attribute to address this requirement here in documentation.
Alternative solution:
Apparently, there's no a straight forward procedure for bounding the time range of a resource calendar. So I decided to bound a resource calendar by creating fake events for those time ranges that the calendar should be unavailable. In this way, the users cannot book (i.e. create any events) on those specific time ranges!
OR
You can read every changes on a calendar (polling or push notification if applicable), then compare the created events with your system's events, and if there are any events that have conflicts with the system's events (booking), decline those google calendar events consequently.

Send Google Calendar events with different descriptions

I need to create a google calendar event using the Google API:
Each attendee should receive a different content in the description of the invite. Is there a way to pass description on attendee?
Answer:
It is not possible to do this.
More Information:
The information about an event is tied to the event itself in Google Calendar, rather than to the invite that is sent to the attendees. The invitation will have information contained within it about the event that it is related to. There is only one description, and so this same description will be sent to all attendees in the invitation.

Edit Google Calendar "From" and "Organizer"

I want to create event via google calendar api using Go. I found out that the sender (From) is whoever responsible in client_id I provide in the google API, in this case me. Can I edit this sender, so that it is not sent from me? At least I can edit the display name of the sender, the email I think will always be my email
Also about editing the organizer, I tried to use move action but it only moves the event, not change the organizer. Is there other way to edit organizer?
To address your questions:
1. Can I create an event from another address?
What you want can be done by creating a service account and performing domain-wide-delegation
What is a service account?
A service account is a special type of Google account intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs - in your situation the Calendar API.
After creating the above mentioned service account, you will have to perform domain-wide-delegation and impersonate a user in your domain in order to be able to create the event wanted.
Now, when writing the code for your application, you will have the use the credentials that were created for this account in order to authorize the requests.
OR
If you want to specifically edit only the display name of the creator of the event, you can perform an update request:
PUT https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId
And add in the request body this:
"creator": {
"displayName": "UPDATED DISPLAY NAME"
}
2. Can I edit the organizer?
According to the Calendar API Documentation:
organizer > The organizer of the event. If the organizer is also an attendee, this is indicated with a separate entry in attendees with the organizer field set to True. To change the organizer, use the move operation. Read-only, except when importing an event.
Therefore, the organizer can be changed/updated only when importing the event in question.
Reference
Authorizing Requests to the Google Calendar API
;
Creating A Service Account;
Calendar API Events Resource;
Calendar API Events:Update.

How to set label for Hangouts Meeting via API

Background
I'm trying to create an appointment calendar using GSuite and Google Calendar API. When a user (no Google account and outside the GSuite organization) creates an appointment, I'm trying to create a Calendar event on the Calendar of an organization member via the Google Calendar API and generate a Hangouts meeting link.
Problem
I can create the event and the Hangouts meeting link, but I cannot create a custom label for the video link. I was able to make it slightly unique by adding an attendee with a fake email xczczf#example.com to John Doe's calendar to get a label of doe-j-xcz, but I would like full control over the label if possible.
Attempted Solutions That Didn't Work
Create the event and provide a conferenceData.createRequest and an entryPoint with the desired label.
Create the event first and then send a patch with the information described in 1
Changing the conferenceId
After messing around with the API Explorer, a custom label can be made by:
Creating the Cal event and adding a meeting link using a createRequest
Send a Patch with conferenceData.conferenceId set to the unique label value

Attendee not getting meeting invite on creating event using service account, google calendar API

Hi I am creating an event using service account and added attendees. The response returned correctly but attendees are not getting invite mails. The Service account is not linked (shared) with any google account. Though to login into API console I used my gmail account. Calendar Id was given as Primary. Where the event will get created, on Service account's Calendar or my primary Calendar?. I could not see it on mine Calendar but response returned with Status "Confirmed". I am more interested in invites rather where the original event got created.
Any help would be appreciated !!!
You need to remember that a service account is not you. Think of a service account as a dummy user. It has its own calendar account, drive account and probably a bunch more. When you inserted an event into primary you inserted it into the service accounts primary calendar.
You have a few options.
Share your primary calendar with the service account. Just add it as a user. Find the calendar id in the settings and have the service account insert into that calendar id.
Have the service account share its primary calendar with you by granting you permissions to it. you should then be able to see it on the bottom left hand side of the Google calendar website.
Have the service account invite you to the event on the service accounts Google calendar.
Have the service account create the event with you as an attendee event.insert check the body of the request.

Resources