Question 100 of 100 from exam 350-901-DEVCOR: Developing Applications Using Cisco Core Platforms and APIs

Question 100 of 100 from exam 350-901-DEVCOR: Developing Applications Using Cisco Core Platforms and APIs

Question

import requests
import json

webex_teams_token = "ODAyN2TzZDMtYj JmNy00OTkSLWJkZDAtM}VKNJBkYJAxY}Q0xxxxxx_PF84_" \
"12345678-1234-abcd-1234-abcdef1234"
webex_teams_url = "https://api.ciscospark.com/v1/"
webex_teams headers = {"content-type": “application/json",
"Authorization": "Bearer " + webex_teams_token}

user_list = ["userl@example.com", "user2@example.com", "user3¢example.com")

def create_space (title)
“Creates a new Webex Teams space and returns the Space ID"
data = ("title": title)
response = requests.post (webex_teams_url + "rooms", headers=webex_teams_headers,
data=json.dumps (data) )
if response. status_code == 200:
content = json.loads (response.content)
return content [*id']
else:
raise Exception('Error creating space. HTTP Error Code: {}' .format (response. status_code))

def add_user_to_space(user, space):
"add member to Webex Teams Space by email and returns membership I
data = {"roomId": space, "personEmail": user}
response = requests.post (webex_teams_url + "memberships", headers-webex_teams_headers,
data=json.dumps (data) )
if response.status_code == 200:
content = json. loads (response.content)
return content ['id"]
else:
raise Exception('Error Adding (} to space. HTTP Error Code: {}'. format (user,
response. status_code) )

Refer to the exhibit.

Which snippet creates a Webex Teams space and adds the users in the variable user_list to that space? A.

space = create_space("Chatops Incident Space")
user = ",".join(user_list)
add_user_to_space (space)

B.

space = create_space("Chatops Incident Space")
for user in user list:
add_user_to_space(user, space)

C.

space = create space("Chatops Incident Space")
for user in user_list:
add_user_to_space (space)

D.

space = create_space("Chatops Incident Space")

user = join(user list)
add_user to space(users, space)

Explanations

A.