200-901 Question 37
Single answerYou are working with a network device that provides a REST API to retrieve the list of VLANs configured on the device. The API documentation specifies the following details for the request:
- Endpoint:
GET /api/v1/vlans - Authentication: Bearer token in the Authorization header
Which HTTP request would correctly retrieve the VLAN list?
- A
GET /api/v1/vlans HTTP/1.1 Authorization: Bearer
Host: 192.168.1.1 - B
POST /api/v1/vlans HTTP/1.1 Authorization: Bearer
Host: 192.168.1.1 - C
GET /api/v1/vlans HTTP/1.1 Host: 192.168.1.1
- D
GET /api/v1/vlans HTTP/1.1 Authorization: Basic
Host: 192.168.1.1
Show answer and explanation
Correct answer: A
Explanation
To construct a REST API request, it is essential to carefully follow the API documentation. In this case, the API specifies the GET method, the /api/v1/vlans endpoint, and the use of a Bearer token in the Authorization header for authentication. Only the first option adheres to all these requirements, making it the correct answer.
- A. Correct.
This is the correct answer because it matches the API documentation, using the GET method, the correct endpoint, and a Bearer token in the Authorization header.
- B. Incorrect.
This is incorrect because the POST method is not specified in the documentation for retrieving VLANs. The correct method is GET.
- C. Incorrect.
This is incorrect because it does not include the Bearer token in the Authorization header, which is required for authentication according to the API documentation.
- D. Incorrect.
This is incorrect because it uses Basic authentication instead of the Bearer token, which does not align with the API documentation.