A network engineer needs to update the description field of an existing interface resource on a router using a RESTful API. The requirement specifies that only the description attribute should be modified, while leaving all other existing configuration parameters for that interface unchanged on the server. Which HTTP verb and payload strategy should be selected to perform this operation?
- HTTP PATCH with a payload containing only the updated description attributeCevap
- BHTTP PUT with a payload containing only the updated description attribute
- CHTTP POST with a payload containing the interface identifier and updated description
- DHTTP GET with the updated description parameters appended as query strings
Cevap
Use HTTP PATCH with a payload containing only the modified description attribute.
HTTP PATCH is specifically designed for partial modifications to an existing resource. When an API receives an HTTP PATCH request, it applies changes only to the keys included in the request body, leaving all unmentioned resource attributes intact.
Adım Adım Çözüm
Anahtar Kavram
HTTP Verbs and Resource Mutation (PATCH vs. PUT)