Cisco
350-901 · Question #83
Refer to the exhibit. Which snippet creates a Webex Teams space and adds the users in the variable user_list to that space? import requests import json webex_teams_token = "QDAyN2I3MjMyMzY0OTY3ZDAwNjV
Sign in or unlock 350-901 to reveal the answer and full explanation for question #83. The question stem and answer options stay visible for context.
Using APIs
Question
Refer to the exhibit. Which snippet creates a Webex Teams space and adds the users in the variable user_list to that space?
import requests
import json
webex_teams_token = "QDAyN2I3MjMyMzY0OTY3ZDAwNjVkYjJjAXVjQzxxxxxxxx_FFS4_"
webex_teams_url = "https://api.ciscospark.com/v1/"
webex_teams_headers = {"Content-Type": "application/json",
"Authorization": "Bearer " + webex_teams_token}
user_list = ["[email protected]", "[email protected]"]
def create_space(title):
This creates a Webex Teams space and returns the Space IDTMTM
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, user):This add a member to a Webex Teams space by email and returns membership IDTMTM
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))Options
- Aspace = create_space("Chatops Incident Space") user = ". ".join(user_list) add_user_to_space (space)
- Bspace = create_space("Chatops Incident Space") for user in user_list: add_user_to_space (user, space)
- Cspace = create_space("Chatops Incident Space") for user in user_list: add_user_to_space (space, user)
- Dspace = create_space("Chatops Incident Space") user = ". ".join(user_list) add_user_to_space (users, space)
Unlock 350-901 to see the answer
You've previewed enough free 350-901 questions. Unlock 350-901 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#Python Loops#Function Calls#Webex Teams API#API Integration