Update an existing room
This code snippet shows how to update an existing room using the Meetings API.
See the API Reference for more information.
Example Request
Where needed, replace the following variables in the sample code with your own values:
| Key | Description |
|---|---|
JWT | Used to authenticate your request. See Authentication for more information, including how to generate a JWT. |
THEME_ID | The theme UUID. |
ROOM_ID | The room UUID. |
VONAGE_APPLICATION_ID | The Vonage Application ID. |
VONAGE_APPLICATION_PRIVATE_KEY_PATH | Private key path. |
Write the code
Add the following to update-room.sh:
curl -X PATCH "https://api-eu.vonage.com/meetings/rooms/"$ROOM_ID \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{
"update_details": {
"theme_id": "'$THEME_ID'"
}
}'Run your code
Save this file to your machine and run it:
Prerequisites
npm install @vonage/server-sdkCreate a file named request.js and add the following code:
const { Auth } = require('@vonage/auth');
const { Meetings } = require('@vonage/meetings');
const credentials = new Auth({
privateKey: VONAGE_APPLICATION_PRIVATE_KEY_PATH,
applicationId: VONAGE_APPLICATION_ID,
});Write the code
Add the following to request.js:
const run = async () => {
try {
const room = await meetingsClient.getRoom(ROOM_ID);
room.expiresAt = ROOM_EXPIRATION_DATE;
await meetingsClient.updateRoom(ROOM_ID, room);
} catch (error) {
console.error(error);
}
};
run();Run your code
Save this file to your machine and run it:
Prerequisites
Add the following to build.gradle:
implementation 'com.vonage:server-sdk:8.15.1'Create a class named UpdateRoom and add the following code to the main method:
VonageClient client = VonageClient.builder()
.applicationId(VONAGE_APPLICATION_ID)
.privateKeyPath(VONAGE_PRIVATE_KEY_PATH)
.build();Write the code
Add the following to the main method of the UpdateRoom class:
UpdateRoomRequest request = UpdateRoomRequest.builder().themeId(THEME_ID).build();
MeetingRoom room = client.getMeetingsClient().updateRoom(ROOM_ID, request);Run your code
We can use the application plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
apply plugin: 'application'
mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''Run the following gradle command to execute your application, replacing com.vonage.quickstart.meetings with the package containing UpdateRoom:
Prerequisites
Install-Package VonageCreate a file named UpdateRoom.cs and add the following code:
using Vonage;
using Vonage.Meetings.UpdateRoom;
using Vonage.Request;Add the following to UpdateRoom.cs:
var credentials = Credentials.FromAppIdAndPrivateKeyPath(applicationId, privateKeyPath);
var client = new VonageClient(credentials);Write the code
Add the following to UpdateRoom.cs:
var request = UpdateRoomRequest.Build()
.WithRoomId(roomId)
.WithThemeId(themeId)
.Create();
var response = await client.MeetingsClient.UpdateRoomAsync(request);Prerequisites
pip install vonageCreate a file named request.py and add the following code:
import vonage
client = vonage.Client(
application_id=VONAGE_APPLICATION_ID,
private_key=VONAGE_APPLICATION_PRIVATE_KEY_PATH,
)Write the code
Add the following to request.py:
params = {'update_details': {'theme_id': THEME_ID}}
response = client.meetings.update_room(ROOM_ID, params)Run your code
Save this file to your machine and run it:
Prerequisites
gem install vonageCreate a file named update-room.rb and add the following code:
Run your code
Save this file to your machine and run it:
Example Response
{
"id": "9f6fe8ae-3458-4a72-b532-8276d5533e97",
"display_name": "My custom room",
"metadata": "Welcome to my custom room",
"type": "instant",
"recording_options": {
"auto_record": false,
"record_only_owner": false
},
"meeting_code": "280674154",
"is_available": true,
"theme_id": "ef2b46f3-8ebb-437e-a671-272e4990fbc8",
"created_at": "2023-06-06T06:45:07.135Z",
"expires_at": "2023-06-06T06:55:07.134Z",
"expire_after_use": true,
"join_approval_level": "none",
"initial_join_options": {
"microphone_state": "on"
},
"callback_urls": {
"rooms_callback_url": "https://example.com/rooms",
"sessions_callback_url": "https://example.com/sessions",
"recordings_callback_url": "https://example.com/recordings"
},
"available_features": {
"is_recording_available": true,
"is_chat_available": true,
"is_whiteboard_available": true,
"is_locale_switcher_available": true,
"is_captions_available": false
},
"ui_settings": {
"language": "es"
},
"_links": {
"guest_url": {
"href": "https://meetings.vonage.com/280674154"
},
"host_url": {
"href": "https://meetings.vonage.com/?room_token=280674154&participant_token=eyJhbGciOiJIUzI1NiIsInR5cC"
}
}
}