Soru

Zorluk: Çok zorCharacteristics of REST-Based APIs (CRUD, HTTP Verbs, Data Formats)

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?

  1. 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
  2. B
    The administrator used HTTP POST, which creates a new resource subtree and overwrites parent fields; HTTP PUT should have been used for a partial update.
  3. C
    The administrator used HTTP PATCH, which modifies child attributes by resetting unlisted parameters; HTTP POST should have been used for a partial update.
  4. D
    The 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

1
Analyze the observed behavior after the API request execution.
The API returned a 204 No Content success code, but unmentioned fields (IP address and admin status) were deleted/reset.
Understanding resource mutation semantics helps identify which verb replaces the entire schema tree vs updating individual leaves.
2
Differentiate between HTTP PUT and HTTP PATCH REST operations.
HTTP PUT operates as a full resource replacement (Create/Replace). Any omitted JSON/XML elements in a PUT payload are assumed to be set to null or default values. HTTP PATCH operates as a partial update (Modify), altering only key-value pairs present in the request body.
REST API definitions mandate that PUT replaces the target entity in its entirety, whereas PATCH applies partial modifications to a resource.
3
Select the correct combination matching the scenario requirement.
The initial request was HTTP PUT (causing full replacement), and the correct verb for partial update is HTTP PATCH.
Using PATCH preserves all non-targeted interface parameters while modifying only the description field.

Anahtar Kavram

RESTful HTTP Verbs and CRUD Operation Semantics (PUT vs PATCH)
Bu soruyu puanla