DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1

For example, say that you want to use the Teams API to
create a new team named DevNet Associate Certification
Room. To do so, you use the POST method and the API
https://webexapis.com/v1/teams.


You can use a Python request to make the REST call.
Example 10-1 shows a Python script that sends a POST
request to create a new team. It initializes variables such
as the base URL, the payload, and the headers, and it
calls the request.


Example 10-1 Python Code to Create a New Team

Click here to view code image


""" Create Webex Team """
import json
import requests
URL = "https://webexapis.com/v1/teams"
PAYLOAD = {
"name": "DevNet Associate Certification
Team"
}
HEADERS = {
"Authorization": "Bearer
MDA0Y2VlMzktNDc2Ni00NzI5LWFiNmYtZmNmYzM3OTkyNjMxNmI0ND-
VmNDktNGE1_PF84_consumer",
"Content-Type": "application/json"
}
RESPONSE = requests.request("POST", URL,
data=json.dumps(PAYLOAD), headers=HEADERS)
print(RESPONSE.text)

Rooms API


Rooms are virtual meeting places where people post
messages and collaborate to get work done. The Rooms
API is used to manage rooms—to create, delete, and
rename them. Table 10-5 lists the operations that can be
performed with the Rooms API.


Table 10-5 Webex Teams: Rooms API
Free download pdf