300-835 · Question #47
Drag and drop the code snippets from the bottom onto the blanks in the code to implement a call to create a space and add users to the newly created space using Webex API. Not all options are used.
The options field is empty ({}), so no code snippets were included in your message. Without the actual drag-and-drop options, I can't tell you exactly which snippet goes in which blank. That said, I can give you a thorough explanation of the concept and correct approach, which…
Question
Explanation
The options field is empty ({}), so no code snippets were included in your message. Without the actual drag-and-drop options, I can't tell you exactly which snippet goes in which blank.
That said, I can give you a thorough explanation of the concept and correct approach, which will help you reason through the question on your own.
Overall Goal
The task is to use the Webex REST API to:
- Create a space (called a "room" in Webex API terminology)
- Add one or more users to that newly created space
This is a two-step API workflow because Webex's API is resource-oriented - you must create the resource first, then associate other resources with it.
Step 1: Create the Space
Endpoint: POST https://webexapis.com/v1/rooms
Why this step: A space must exist before users can be added to it. The POST request creates the room and returns a response containing the room's unique id.
Key request details:
- Header:
Authorization: Bearer <your_access_token> - Header:
Content-Type: application/json - Body:
{ "title": "My New Space" }
What goes wrong if skipped: You'll have no roomId to reference in Step 2 - the membership call will fail.
Step 2: Extract the Room ID from the Response
Why this step: The API response from Step 1 is JSON. You must parse it and extract the id field (the room ID) to use in the next call.
room_id = response.json()["id"]
What goes wrong if skipped: You can't dynamically target the newly created space - you'd have to hardcode an ID, which defeats the purpose.
Step 3: Add Users to the Space
Endpoint: POST https://webexapis.com/v1/memberships
Why this step: Membership is a separate resource in Webex. Creating a space does not automatically add anyone besides the token owner.
Key request details:
- Same auth headers
- Body:
{ "roomId": "<room_id>", "personEmail": "[email protected]" }
What goes wrong if skipped or done out of order: If done before Step 1, there's no valid roomId. If the roomId is wrong, the API returns a 404 or 403.
Tip for Remembering
Think of it like renting an apartment before giving someone a key:
Create the room → Get its ID → Add members by referencing that ID
The Webex API separates creation from membership intentionally, so you can add/remove users independently at any time.
If you paste the actual code snippet options, I can map exactly which goes in each blank.
Topics
Community Discussion
No community discussion yet for this question.