300-910 · Question #38
FILL BLANK Fill in the blanks to complete the line of Python code that sends a message to a Webex Teams room or person. response = requests.___________('https://api.ciscopark.com/v1/___________', head
This question tests knowledge of the Cisco Webex Teams (formerly Cisco Spark) REST API and how to use Python's requests library to send a message. The two blanks require the correct HTTP method and the correct API resource endpoint.
Question
response = requests.___________('https://api.ciscopark.com/v1/___________', headers=message_header, data=message_data)Exhibit
Explanation
This question tests knowledge of the Cisco Webex Teams (formerly Cisco Spark) REST API and how to use Python's requests library to send a message. The two blanks require the correct HTTP method and the correct API resource endpoint.
Approach. The first blank should be 'post' - sending a message creates a new resource, so the HTTP POST method is correct (requests.post). The second blank should be 'messages' - the Webex Teams REST API endpoint for sending a message to a room or person is /v1/messages. Together, the complete line is: requests.post('https://api.ciscopark.com/v1/messages', headers=message_header, data=message_data). The headers typically carry the Authorization Bearer token and Content-Type, while the data payload contains the roomId (or toPersonEmail) and the message text.
Concept tested. Webex Teams (Cisco Spark) REST API usage - specifically knowing that creating/sending a message requires an HTTP POST request to the /v1/messages endpoint, and how to structure that call using Python's requests library with authentication headers and a message payload.
Reference. Cisco DevNet - Webex Teams REST API: POST /v1/messages (https://developer.webex.com/docs/api/v1/messages/create-a-message)
Topics
Community Discussion
No community discussion yet for this question.
