Update an existing theme
This code snippet shows how to update an existing theme 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. |
VONAGE_APPLICATION_ID | The Vonage Application ID. |
VONAGE_APPLICATION_PRIVATE_KEY_PATH | Private key path. |
THEME_ID | The theme UUID. |
MAIN_COLOR | The main color that will be used for the meeting room. |
BRAND_TEXT | The text that will appear on the meeting homepage, in the case that there is no brand image. |
Write the code
Add the following to update-theme.sh:
curl -X PATCH "https://api-eu.vonage.com/meetings/themes/"$THEME_ID \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{
"update_details": {
"main_color": "'$MAIN_COLOR'",
"brand_text": "'$BRAND_TEXT'"
}
}'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,
});
const meetingsClient = new Meetings(credentials);Write the code
Add the following to request.js:
const run = async () => {
try {
const theme = await meetingsClient.getTheme(THEME_ID);
theme.mainColor = '#c0ffee';
theme.brand = 'Brand';
await meetingsClient.updateTheme(THEME_ID, theme);
} catch (error) {
console.error(error);
}
};
run();Run your code
Save this file to your machine and run it:
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_PRIVATE_KEY,Write the code
Add the following to request.py:
response = client.meetings.update_theme(
THEME_ID,
{
'main_color': MAIN_COLOR,
'brand_text': BRAND_TEXT,
},Run your code
Save this file to your machine and run it:
Prerequisites
gem install vonageCreate a file named update-theme.rb and add the following code:
Run your code
Save this file to your machine and run it:
Example Response
{
"theme_id": "ef2b46f3-8ebb-437e-a671-272e4990fbc8",
"theme_name": "Theme1",
"domain": "VCP",
"account_id": "123ab4cd",
"application_id": "921a6f5b-1f94-49f4-8107-26f0c75fc6e7",
"main_color": "#12f64e",
"short_company_url": "short-url",
"brand_text": "Brand",
"brand_image_colored": "branded-image-colored",
"brand_image_white": "branded-image-white",
"branded_favicon": "branded-favicon",
"brand_image_colored_url": "branded-image-colored-url",
"brand_image_white_url": "branded-image-white-url",
"branded_favicon_url": "branded-favicon-url"
}