A network administrator sends an HTTP request to a Cisco RESTCONF API endpoint attempting to update only the description of interface GigabitEthernet0/1. The API responds with an HTTP status code indicating success (204 No Content). However, a subsequent GET request reveals that the interface's previously configured IP address and administrative status were removed and reset to default values. Which HTTP verb was executed to cause this full resource replacement, and which HTTP verb should have been used instead to perform a partial update that preserves the existing unmentioned attributes?
- The administrator used HTTP PUT, which replaces the target resource entirely with the request payload; HTTP PATCH should have been used for a partial update.Cevap
- BThe administrator used HTTP POST, which creates a new resource subtree and overwrites parent fields; HTTP PUT should have been used for a partial update.
- CThe administrator used HTTP PATCH, which modifies child attributes by resetting unlisted parameters; HTTP POST should have been used for a partial update.
- DThe administrator used HTTP OPTIONS, which applies default configuration templates to target resources; HTTP GET should have been used for a partial update.
Cevap
The administrator executed an HTTP PUT request, which performs a complete resource replacement, and should have used an HTTP PATCH request to perform a partial update.
In REST-based network automation APIs (such as RESTCONF and Cisco DNA Center APIs), HTTP PUT maps to the update/replace CRUD operation. Executing a PUT request replaces the entire target resource with the payload supplied in the body. If optional fields (such as IP address or administrative status) are omitted from the PUT payload, the API server replaces the existing configuration object with the new partial payload, clearing or defaulting all omitted attributes. Conversely, HTTP PATCH is designed specifically for partial updates; it modifies only the fields present in the request body while leaving all unmentioned configuration parameters unchanged.
Adım Adım Çözüm
Anahtar Kavram
RESTful HTTP Verbs and CRUD Operation Semantics (PUT vs PATCH)