300-435 Question 260
Select 3You are tasked with retrieving operational data from Cisco SD-WAN vManage using its REST API. You write a Python script to authenticate to the vManage API and fetch the list of all devices in the network. Which of the following steps are required to perform this task successfully?
- A
Use the 'requests' library in Python to send an HTTP POST request for authentication to vManage's '/j_security_check' endpoint.
- B
Parse the 'JSESSIONID' cookie from the authentication response and include it in the headers of subsequent requests.
- C
Send an HTTP GET request to the '/dataservice/device' endpoint to retrieve the list of devices.
- D
Include the API token in the body of the GET request instead of the headers.
- E
Set the Content-Type header to 'application/json' for all requests to the vManage API.
Show answer and explanation
Correct answers: A, B, C
Explanation
To interact with the Cisco SD-WAN vManage API using Python, you must first authenticate by sending a POST request to the '/j_security_check' endpoint and retrieve the 'JSESSIONID' cookie. This cookie is then included in the headers of subsequent API requests, such as a GET request to the '/dataservice/device' endpoint to fetch the list of devices. Proper understanding of authentication and request formatting is crucial for successful automation with the vManage API.
- A. Correct.
Correct. To authenticate to vManage, you need to send an HTTP POST request to the '/j_security_check' endpoint using the 'requests' library, as this is the standard method for obtaining a session cookie.
- B. Correct.
Correct. The 'JSESSIONID' cookie from the authentication response must be extracted and included in the headers of subsequent API requests to maintain the session.
- C. Correct.
Correct. To retrieve the list of devices, you send an HTTP GET request to the '/dataservice/device' endpoint, which provides the required operational data.
- D. Incorrect.
Incorrect. The API token or session cookie must be included in the headers, not in the body of the GET request.
- E. Incorrect.
Incorrect. While 'application/json' is commonly used for POST or PUT requests, it is not a strict requirement for GET requests in the vManage API unless explicitly stated.