This guide explains how to create, get, and update a meeting space plus end an
active conference on the spaces resource of the Google Meet REST API.
Create a meeting space
To create a meeting space,
use the create method
on the spaces resource.
The method returns an instance of a spaces resource, which includes the
SpaceConfig object
that's the configuration for the meeting space. It also contains the
ActiveConference
object that's a link to the current
conferenceRecords
resource within the meeting space.
The following code sample shows how to create a meeting space:
Java
Node.js
Python
Apps Script
function createMeetingSpace() {
const response = UrlFetchApp.fetch(
'https://meet.googleapis.com/v2/spaces',
{
method: 'post',
contentType: 'application/json',
headers: {
Authorization: 'Bearer ' + ScriptApp.getOAuthToken(),
},
payload: JSON.stringify({}),
}
);
const space = JSON.parse(response.getContentText());
Logger.log('Space name: ' + space.name);
Logger.log('Meeting URI: ' + space.meetingUri);
return space;
}
cURL
curl -X POST "https://meet.googleapis.com/v2/spaces" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
Replace ACCESS_TOKEN with the access token that grants access to the API.
Get a meeting space
To get details about an active meeting space and its settings, use the
get method on the
spaces resource. Set the
name path parameter using the format spaces/{space} or
spaces/{meetingCode}. For more information, see How Meet
identifies a meeting
space.
The method returns a meeting space as an instance of the
spaces resource. To determine
if an active conference exists, examine the activeConference field.
The following code sample shows how to retrieve a meeting space:
Java
Node.js
Python
Apps Script
function getMeetingSpace(spaceName) {
// spaceName format: "spaces/{space}" or "spaces/{meetingCode}"
const response = UrlFetchApp.fetch(
`https://meet.googleapis.com/v2/${spaceName}`,
{
method: 'get',
headers: {
Authorization: 'Bearer ' + ScriptApp.getOAuthToken(),
},
}
);
const space = JSON.parse(response.getContentText());
Logger.log('Space name: ' + space.name);
Logger.log('Meeting URI: ' + space.meetingUri);
if (space.activeConference) {
Logger.log('Active conference: ' +
space.activeConference.conferenceRecord);
}
return space;
}
cURL
curl -X GET "https://meet.googleapis.com/v2/spaces/SPACE_NAME" \
-H "Authorization: Bearer ACCESS_TOKEN"
Replace ACCESS_TOKEN with the access token that grants access to the API.
Replace the space name value with the unique server-generated ID for the meeting space.
Update a meeting space
To update the details of a meeting space, use the
patch method on the
spaces resource. Set the
space.name path parameter using the format spaces/{space}. For more
information, see How Meet identifies a meeting
space.
The patch method also takes an optional updateMask query parameter. The
field is of type
FieldMask.
This is a comma-delimited list of fields you want to update in the space.
The method returns a meeting space as an instance of the
spaces resource.
The following code sample shows how to update a meeting space:
Java
Node.js
Python
Apps Script
function updateMeetingSpace(spaceName) {
// spaceName format: "spaces/{space}"
const baseUrl = 'https://meet.googleapis.com/v2/';
const mask = 'updateMask=config.accessType';
const url = `${baseUrl}${spaceName}?${mask}`;
const response = UrlFetchApp.fetch(url, {
method: 'patch',
contentType: 'application/json',
headers: {
Authorization: 'Bearer ' + ScriptApp.getOAuthToken(),
},
payload: JSON.stringify({
config: {
accessType: 'RESTRICTED',
},
}),
});
const space = JSON.parse(response.getContentText());
Logger.log('Updated space: ' + space.name);
return space;
}
cURL
curl -X PATCH "https://meet.googleapis.com/v2/spaces/SPACE_NAME?updateMask=config.accessType" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"config": {
"accessType": "RESTRICTED"
}
}'
Replace ACCESS_TOKEN with the access token that grants access to the API.
Replace the space name value with the unique server-generated ID for the meeting space.
End an active conference
To end an active conference within a meeting space (if there's one), use the
endActiveConference
method on the spaces resource.
Set the name path parameter using the format spaces/{space}. Both the
request and response body are empty. For more information, see How
Meet identifies a meeting
space.
The following code sample shows how to end an active conference:
Java
Node.js
Python
Apps Script
function endActiveConference(spaceName) {
// spaceName format: "spaces/{space}"
const url =
`https://meet.googleapis.com/v2/${spaceName}:endActiveConference`;
UrlFetchApp.fetch(url, {
method: 'post',
contentType: 'application/json',
headers: {
Authorization: 'Bearer ' + ScriptApp.getOAuthToken(),
},
payload: JSON.stringify({}),
});
Logger.log(`Ended active conference in ${spaceName}`);
}
cURL
curl -X POST "https://meet.googleapis.com/v2/spaces/SPACE_NAME:endActiveConference" \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{}'
Replace ACCESS_TOKEN with the access token that grants access to the API.
Replace the space name value with the unique server-generated ID for the meeting space.
Related topics
- Google Meet meeting spaces overview
- Configure meeting space settings
- Manage meeting space members
- Work with conferences