How to Use Postman with Whereby's API
Learn how to use Postman with Whereby's Embedded API collection to create and manage meeting rooms before you begin writing code.
You can use Whereby Embedded API with your favorite programming language to add video calling to your website or mobile application. If, however, you'd like to test the API before beginning your project, you can use an API client. In this post, you'll learn how how to use the Postman API client to interact with the Whereby API.
What you'll need
A Whereby Embedded account. You can try it for free.
A Postman account.
You can use Postman from your browser, or you can download and install the Postman desktop client.
Using the Whereby Postman Collection
The easiest way to get started using Postman with the Whereby Embedded API is to use Whereby's Embedded API Postman collection. This collection contains pre-set HTTP requests that you can use to create and delete rooms. Click the Fork button to copy the collection to your own Postman workspace.
At the next screen, enter a name for your copy of the collection and select a workspace. Then click or tap the Fork Collection button to save your changes.
After you've forked the collection, log in to your Whereby Embedded account to create an API key.
Create an API Key
Once you've logged in to your Whereby account, go to the Configure screen. Use the Generate key button to create a new API key.
Copy the API key to your clipboard. You'll save it as a variable in your Postman account.
Save the Key to Postman
Return to Postman and open the Variables screen. This screen has two declared variables — MY_WHEREBY_API_KEY
and MEETINGID
— but neither variable has an assigned value.
Paste your API key in the CURRENT VALUE column of the MY_WHEREBY_API_KEY
row, and save your changes. Depending on the size of your browser window, and Postman screen layout, the Save control may be hidden under a menu. Look for the three circles next to the Fork control, or close the Documentation panel.
Saving your API key to the CURRENT VALUE field saves it for the length of your current browser session. If you'd like to make the API key persist across multiple sessions, you can save it in the INITIAL VALUE column. Be aware, however, that persisting your API key exposes it to anyone with access to your Postman account.
Once you've saved your Whereby API key, you're ready to make requests.
Create a Room
The advantage of using Whereby's Embedded API Postman Collection is that the most common requests are pre-configured with the required headers and settings. To create a room, for example, click the Create room request, then click Send.
You'll see the URL for your newly-created room as part of the API response. Copy and paste the value of the roomUrl
property into your browser to use your new room.
Each request in the Embedded API collection includes a JSON request body with preset values. You can change these values using the Body screen.
Postman also supports pre-request scripts and environment variables. The Create room request, for example, uses a pre-request script to set the value of endDate
in the request body.
Delete a Room
Click on the Delete a room request. You can see that the URL contains a {{MEETINGID}}
placeholder. To delete a room, you need to pass a meeting ID a path parameter. You'll need to set a value for the MEETINGID
variable.
Go back to the response from the Create room request. Copy the meetingId value, then paste it in the CURRENT VALUE column of the MEETINGID row. Don't forget to save your changes.
Return to the Delete a room request screen, and press Send. If everything goes well, the API will return a 204 No Content
response header and no response body.
Get a List of Rooms
If you've followed along with this guide, you may have created a few meeting rooms by now. You can see all of the rooms you've created by sending a GET
request to the /meetings
endpoint.
Whereby's Embedded API Postman collection does not include a request for listing meetings. You can, however, create one. Duplicate the Get information for a room request and rename it to Get list of rooms.
Next, delete the {{MEETINGID}} variable from the end of the URL.
Now if you press Send, you'll receive a JSON response containing two properties: results
and cursor
. The results
property contains an array of meeting objects; cursor
indicates whether there are additional rooms that aren't included in this response. If there are more rooms, cursor
will contain a string value, otherwise its value is null
.
By default, the API returns a maximum of 50 room objects per request. You can change that by passing { "limit": <xxx> }
in the request body, where <xxx>
is an integer ranging from 1 to 100. The API reference has more details about working with meeting lists and the cursor
property.
You can duplicate and adapt requests in the collection to work with other endpoints as we've done here.
Postman lets you explore the Whereby Embedded API without needing to set up a development environment or project first.