DevNet Associate (DEVASC) v1.0Infrastructure and AutomationEasy
A developer is writing a Python script to interact with a network device's configuration. The device exposes its configuration via RESTCONF. The developer needs to retrieve the current running configuration of a specific interface. Which HTTP method should the script use for this operation?
- ADELETE
- BGET
- CPUT
- DPOST
Show answer & explanationAnswer & explanation
Correct answer: B. GET
In RESTful APIs, the GET method is used to retrieve (read) data from a resource. For RESTCONF, this means retrieving the current configuration or operational state of a network device or a specific part of it.
Why the other options are wrong
- A. DELETE is used to remove an existing resource.
- C. PUT is used to update or replace an existing resource entirely.
- D. POST is used to create new resources.
RESTCONF GET Method
The RESTCONF GET method is used to retrieve data from a network device. This typically includes configuration data, operational state data, and schema information, identified by a URI.
- Reads data from the device.
- Idempotent (multiple calls yield same result).
- Uses HTTP GET verb.
- URI specifies the target resource.
Memory trick: GET is for 'GETting' information from the device.