Liste de toutes les chambres disponibles
Cet extrait de code montre comment dresser la liste de toutes les salles disponibles à l'aide de l'API Meetings.
Voir le Référence API pour plus d'informations.
Exemple de demande
Le cas échéant, remplacez les variables suivantes dans l'exemple de code par vos propres valeurs :
| Clé | 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. |
Rédiger le code
Ajouter ce qui suit à list-rooms.sh:
curl -X GET https://api-eu.vonage.com/meetings/rooms \
-H "Authorization: Bearer $JWT"Exécutez votre code
Enregistrez ce fichier sur votre machine et exécutez-le :
Conditions préalables
npm install @vonage/server-sdkCréez un fichier nommé request.js et ajoutez le code suivant :
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);Rédiger le code
Ajouter ce qui suit à request.js:
const run = async () => {
try {
for await (const room of meetingsClient.getRooms()) {
console.log(room);
};
} catch (error) {
console.error(error);
}
};
run();Exécutez votre code
Enregistrez ce fichier sur votre machine et exécutez-le :
Conditions préalables
pip install vonageCréez un fichier nommé request.py et ajoutez le code suivant :
import vonage
client = vonage.Client(
application_id=VONAGE_APPLICATION_ID,
private_key=VONAGE_PRIVATE_KEY,Exécutez votre code
Enregistrez ce fichier sur votre machine et exécutez-le :
Conditions préalables
gem install vonageCréez un fichier nommé list-rooms.rb et ajoutez le code suivant :
client = Vonage::Client.new(
application_id: VONAGE_APPLICATION_ID,
private_key: File.read(VONAGE_APPLICATION_PRIVATE_KEY_PATH)
)Rédiger le code
Ajouter ce qui suit à list-rooms.rb:
rooms = client.meetings.rooms.listExécutez votre code
Enregistrez ce fichier sur votre machine et exécutez-le :
Exemple de réponse
{
"page_size": 25,
"total_items": 30,
"_embedded": [
{
"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"
}
}
}
],
"_links": {
"first": {
"href": "https://api-eu.vonage.com/v1/meetings/rooms?page_size=50"
},
"self": {
"href": "https://api-eu.vonage.com/v1/meetings/rooms?page_size=50&start_id=2293905"
},
"next": {
"href": "https://api-eu.vonage.com/v1/meetings/rooms?page_size=50&start_id=2293906"
},
"prev": {
"href": "https://api-eu.vonage.com/v1/meetings/rooms?page_size=50&start_id=2293904"
}
}
}