nerdexam
Cisco

300-835 · Question #49

Refer to the exhibit. Which code snippet must be added to the blank in the script to create a new Cisco Webex space? import requests import json url = 'https://api.ciscospark.com/v1/rooms' access_toke

The correct answer is D. response = requests.post( url, headers={'Authorization': 'Bearer ' + access_token, 'Content-type': 'application/json;charset=UTF-8'}, data = json.dumps({'title': room_title}) ). Option D is correct because creating a new resource via a REST API requires the POST HTTP method, and authentication must use the access_token - the credential that authorizes direct API calls - concatenated properly after 'Bearer '. A is wrong because it uses refresh_token inste

Cisco Webex API

Question

Refer to the exhibit. Which code snippet must be added to the blank in the script to create a new Cisco Webex space? import requests import json url = 'https://api.ciscospark.com/v1/rooms' access_token = 'Y2lzY29zcGFyazovL24ub3JUMjNhMjNlZmNjLTFhNmMtNDgzMi05MzFjLWFkOTYwZTM2ODc2MTQ' refresh_token = 'SF84_lab65fDf-9643-41c7-9974-ad7cae8e10f_YmNkMjNjMQY0OTczNDZDZUM0TTRhIjIs' room_title = 'My new Teams room'

Options

  • Aresponse = requests.post( url, headers={'Authorization': 'Bearer ' + refresh_token, 'Content-type': 'application/json;charset=UTF-8'}, data = json.dumps({'title': room_title}) )
  • Bresponse = requests.put( url, headers={'Authorization': 'Bearer ' + access_token, 'Content-type': 'application/json;charset=UTF-8'}, data = json.dumps({'title': room_title}) )
  • Cresponse = requests.post( url, headers={'Authorization': 'Bearer ', 'Content-type': 'application/json;charset=UTF-8'}, data = json.dumps({'title': room_title}) )
  • Dresponse = requests.post( url, headers={'Authorization': 'Bearer ' + access_token, 'Content-type': 'application/json;charset=UTF-8'}, data = json.dumps({'title': room_title}) )

How the community answered

(25 responses)
  • A
    8% (2)
  • B
    4% (1)
  • C
    16% (4)
  • D
    72% (18)

Explanation

Option D is correct because creating a new resource via a REST API requires the POST HTTP method, and authentication must use the access_token - the credential that authorizes direct API calls - concatenated properly after 'Bearer '.

  • A is wrong because it uses refresh_token instead of access_token. A refresh token is used only to obtain a new access token via the OAuth flow, not to authenticate API requests directly.
  • B is wrong because it uses requests.put, which is for updating an existing resource, not creating a new one.
  • C is wrong because the Authorization header ends with just 'Bearer ' - the access token is never appended, so the request would fail authentication entirely.

Memory tip: Think POST = Create, PUT = Update, and remember that the access_token is your "ID badge" to enter the building - the refresh_token is only used at the front desk to get a new badge when yours expires.

Topics

#Webex API#REST API#Bearer Token#Access Token

Community Discussion

No community discussion yet for this question.

Full 300-835 Practice