Manage spaces, participants, and messages in Webex

9. Construct code to perform a specific operation based on a set of requirements and given API reference documentation.

📘Cisco DevNet Associate (200-901 DEVASC)


1. What is Webex in the DevNet Context?

Webex is Cisco’s collaboration platform, allowing people and teams to communicate via:

  • Messaging (text)
  • Spaces (group conversations or rooms)
  • Meetings (audio/video)
  • Bots and integrations (automated interactions)

For the DevNet exam, the focus is on using Webex APIs to programmatically manage spaces, participants, and messages.

You don’t need to know every detail of the Webex app interface; what matters is how to use the APIs to create, read, update, and delete resources.


2. Key Webex Concepts

  1. Spaces
    • A space is a “room” where participants can communicate.
    • Can be direct (1:1) or group (multiple participants).
    • Each space has a unique ID used in API operations.
  2. Participants (People in a Space)
    • Participants are members of a space.
    • They can have different roles:
      • Moderator – can manage messages and participants.
      • Member – can send/receive messages.
  3. Messages
    • Messages are text or attachments sent within a space.
    • Each message has a unique ID.
    • Can be posted, retrieved, updated, or deleted via APIs.

3. Webex APIs to Know

Cisco Webex provides REST APIs to manage spaces, participants, and messages.

a) Spaces APIs

ActionAPI EndpointDescription
List all spacesGET /v1/roomsRetrieves all spaces your account has access to.
Create a spacePOST /v1/roomsCreates a new space. You provide a title.
Get space detailsGET /v1/rooms/{roomId}Retrieves info about a specific space.
Delete a spaceDELETE /v1/rooms/{roomId}Deletes a space permanently.

Example:
To create a space called “DevOps Team”:

import requestsurl = "https://webexapis.com/v1/rooms"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
}
data = {
"title": "DevOps Team"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())

b) Participants APIs (Membership)

ActionAPI EndpointDescription
Add a participantPOST /v1/membershipsAdd someone to a space using their email.
List participantsGET /v1/memberships?roomId={roomId}Shows all participants in a space.
Remove participantDELETE /v1/memberships/{membershipId}Remove someone from the space.

Example: Add a participant to “DevOps Team”:

data = {
"roomId": "ROOM_ID",
"personEmail": "john@example.com",
"isModerator": False
}
response = requests.post("https://webexapis.com/v1/memberships", headers=headers, json=data)
print(response.json())

c) Messages APIs

ActionAPI EndpointDescription
Send messagePOST /v1/messagesSend a message to a space.
List messagesGET /v1/messages?roomId={roomId}Retrieve messages from a space.
Get a messageGET /v1/messages/{messageId}Retrieve a specific message.
Delete a messageDELETE /v1/messages/{messageId}Remove a message.

Example: Send a message to a space:

data = {
"roomId": "ROOM_ID",
"text": "Hello DevOps Team! Standup at 10 AM."
}
response = requests.post("https://webexapis.com/v1/messages", headers=headers, json=data)
print(response.json())

4. Authentication

To use Webex APIs, you need a Bearer token. This is a type of access token that you include in your request headers:

Authorization: Bearer YOUR_ACCESS_TOKEN
  • Tokens are obtained from Webex developer portal.
  • They authenticate your scripts or programs to perform API actions.

5. Best Practices for Exam

  1. Know the difference:
    • Room/space – where messages are sent.
    • Membership/participant – who is in the room.
    • Message – the actual communication content.
  2. HTTP Methods:
    • GET → Retrieve data
    • POST → Create data
    • DELETE → Remove data
    • PATCH/PUT → Update data (less common in Webex API)
  3. Required fields:
    • Spaces: title
    • Membership: roomId + personEmail
    • Messages: roomId + text
  4. Pagination:
    • Some GET requests may return paginated results.
    • Look for link headers to get additional results.
  5. Error handling:
    • Common status codes:
      • 200 – Success
      • 201 – Created
      • 400 – Bad request
      • 401 – Unauthorized (check token)
      • 404 – Not found (check room or message ID)

6. Example Workflow in IT Environment

For an IT team using Webex:

  1. Create a space called “Network Alerts”.
  2. Add participants like network engineers or admins.
  3. Send a message automatically via a script when a network device goes down.
  4. Retrieve messages to log all alerts.
  5. Remove participants who leave the team or rotate shifts.

All of this can be automated using Webex APIs and Python scripts.


7. Summary for Exam

  • Webex spaces = rooms
  • Participants = memberships
  • Messages = communications in a space
  • You must know the endpoints for spaces, memberships, messages, and the HTTP methods used
  • Be comfortable reading or writing simple Python scripts to perform these tasks
  • Understand Bearer token authentication and basic error handling

Tip: In the exam, a question might ask which API to use to remove someone from a space or how to post a message programmatically—know the table of endpoints above.

Buy Me a Coffee