Crear un tema
Este fragmento de código muestra cómo crear un Tema utilizando la Meetings API.
Véase el Referencia API para más información.
Ejemplo de solicitud
Cuando sea necesario, sustituya las siguientes variables del código de ejemplo por sus propios valores:
| Clave | Descripción |
|---|---|
JWT | Used to authenticate your request. See Authentication for more information, including how to generate a JWT. |
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. |
VONAGE_APPLICATION_ID | The Vonage Application ID. |
VONAGE_APPLICATION_PRIVATE_KEY_PATH | Private key path. |
Escriba el código
Añada lo siguiente a create-theme.sh:
curl -X POST https://api-eu.vonage.com/meetings/themes \
-H "Authorization: Bearer $JWT" \
-H "Content-Type: application/json" \
-d '{
"main_color": "'$MAIN_COLOR'",
"brand_text": "'$BRAND_TEXT'"
}'Ejecute su código
Guarde este archivo en su máquina y ejecútelo:
Requisitos previos
npm install @vonage/server-sdkCrea un archivo llamado request.js y añade el siguiente código:
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);Escriba el código
Añada lo siguiente a request.js:
meetingsClient.createTheme({
themeName: THEME_DISPLAY_NAME,
mainColor: '#c0ffee',
})
.then((theme) => console.log(theme))
.catch((error) => console.error(error));Ejecute su código
Guarde este archivo en su máquina y ejecútelo:
Requisitos previos
pip install vonageCrea un archivo llamado request.py y añade el siguiente código:
Ejecute su código
Guarde este archivo en su máquina y ejecútelo:
Requisitos previos
gem install vonageCrea un archivo llamado create-theme.rb y añade el siguiente código:
client = Vonage::Client.new(
application_id: VONAGE_APPLICATION_ID,
private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH)
)Escriba el código
Añada lo siguiente a create-theme.rb:
theme = client.meetings.themes.create(
main_color: MAIN_COLOR,
brand_text: BRAND_TEXT
)Ejecute su código
Guarde este archivo en su máquina y ejecútelo:
Ejemplo de respuesta
Su tema ha sido creado.