nerdexam
Cisco

300-835 · Question #77

Refer to the exhibit. The code includes the beginning of a short Python script that is constructed to notify in the guard in case of an intruder alert. Which code snippet completes the script?

The correct answer is D. request.post('https://api.ciscospark.com/v1/messages', headers = {'Authorization': 'Bearer ' + token }, data = { 'toPersonEmail': '[email protected]', 'markdown': '**Warning!** Intruder alert in Section 12' } ). Option D is correct because sending a new message in the Cisco Spark (Webex) API requires a POST request to the /v1/messages endpoint, targeting a recipient via toPersonEmail with a markdown-formatted body - all of which D provides correctly. Why the distractors fail: A uses PUT

Cisco Webex API

Question

Refer to the exhibit. The code includes the beginning of a short Python script that is constructed to notify in the guard in case of an intruder alert. Which code snippet completes the script?

Options

How the community answered

(41 responses)
  • A
    17% (7)
  • B
    7% (3)
  • C
    2% (1)
  • D
    73% (30)

Explanation

Option D is correct because sending a new message in the Cisco Spark (Webex) API requires a POST request to the /v1/messages endpoint, targeting a recipient via toPersonEmail with a markdown-formatted body - all of which D provides correctly.

Why the distractors fail:

  • A uses PUT (for updating existing resources) instead of POST, targets the wrong /v1/rooms endpoint, and uses an html field that isn't a valid Spark message parameter.
  • B uses the correct method and endpoint but passes 'roomId': 'Perimeter Guard Space' - a roomId must be a unique system ID, not a human-readable room name; this would fail to resolve.
  • C posts to /v1/rooms (which creates/manages rooms, not messages) and contains a syntax error: two dictionary values are written back-to-back without a separating comma.

Memory tip: Think "POST a message, email the person" - you're creating (POST) a new message (/v1/messages), and you identify a direct-message recipient with toPersonEmail, not a room name or a PUT update.

Topics

#Cisco Webex API#REST POST method#Bearer authentication#Message endpoint

Community Discussion

No community discussion yet for this question.

Full 300-835 Practice