Cisco Certified Support Technician (CCST) NetworkingAutomation and ProgrammabilityEasy
A network engineer needs to retrieve the current running configuration from a Cisco switch using a RESTful API. Which HTTP method is most appropriate for this read-only operation?
- APUT
- BPOST
- CGET
- DDELETE
Show answer & explanationAnswer & explanation
Correct answer: C. GET
The GET method is specifically designed for retrieving data from a specified resource without altering it. This makes it ideal for read-only operations like fetching a configuration.
Why the other options are wrong
- A. PUT is used to update or create a resource, which is not a read-only operation.
- B. POST is used to submit new data to a specified resource, which changes the resource state.
- D. DELETE is used to remove a specified resource, which is a destructive operation.
HTTP GET Method
The HTTP GET method is used to request data from a specified resource. It is a read-only operation and should not have any side effects on the server.
- Retrieves data from a server.
- Idempotent (multiple identical requests have the same effect as a single one).
- Can be cached and bookmarked.
Memory trick: GET to GRAB, POST to PUT, PUT to UPDATE, DELETE to DITCH.