350-901 · Question #27
QUESTION 28 Drag and Drop Question: Refer to the exhibit below and click on the resource tabs in the top left corner to view resources to help with this question. Complete the Python script by…
This question tests knowledge of the Cisco Webex Teams REST API, specifically how to correctly construct HTTP POST requests to create rooms and add members using the Python requests library. Candidates must know the correct API endpoints, JSON payload keys, and header values.
Question
<item X> on the right. Not all code snippets may be used. The Python script interacts with Webex Teams API to manage rooms and memberships. Exhibit:
#!/usr/bin/python3
import requests, sys
head = { 'Content-Type': <item 12>,
'Authorization': 'Bearer NWU4NjQ0ODJkZlTm...4-ad72cae0e10f' }
res = requests.post(url = 'https://api.ciscopark.com/v1/<item 25>',
headers = head, json = { <item 35>: sys.argv[1] })
spaceId = res.json()['id']
member = [ '[email protected]', '[email protected]' ]
for member in members:
res = requests.post(url=r'https://api.ciscopark.com/v1/<item 45>',
headers = head,
json = { 'roomId' spaceId, <item 5>: member})
Available options for dragging (from the Answer Area on page 2): try, raise_for_status(), except, 401, 404.Explanation
This question tests knowledge of the Cisco Webex Teams REST API, specifically how to correctly construct HTTP POST requests to create rooms and add members using the Python requests library. Candidates must know the correct API endpoints, JSON payload keys, and header values.
Approach. The correct approach requires knowing four Webex Teams API fundamentals: (1) <item 12> should be 'application/json' - the required Content-Type for REST API calls with a JSON body; (2) <item 25> should be 'rooms' - the Webex API endpoint for creating a new room/space via POST; (3) <item 35> should be 'title' - the required JSON key when creating a room (its value comes from sys.argv[1]); (4) <item 45> should be 'memberships' - the endpoint for adding users to a room; and (5) <item 5> should be 'personEmail' - the JSON key used to specify the member being added. The options 'try', 'except', 'raise_for_status()', '401', and '404' are distractors representing error-handling constructs that are not used in this particular script.
Concept tested. Cisco Webex Teams REST API - correct HTTP headers, API endpoint paths (/v1/rooms, /v1/memberships), and JSON payload field names (title, roomId, personEmail) required to programmatically create rooms and manage memberships using Python requests.
Reference. Cisco DevNet: Webex Teams API Reference - https://developer.webex.com/docs/api/v1/rooms and https://developer.webex.com/docs/api/v1/memberships
Topics
Community Discussion
No community discussion yet for this question.