An administrator creates a new syslog server destination entry using a REST API endpoint on a network controller. Shortly after, the administrator needs to modify only the port number parameter for this existing log server entry, while preserving all other existing attributes without re-submitting the full resource payload. Which HTTP request verb and body approach should be utilized to perform this specific modification?
- HTTP PATCH with a payload containing only the port number key-value pairCevap
- BHTTP PUT with a payload containing only the port number key-value pair
- CHTTP POST with a payload containing only the port number key-value pair
- DHTTP GET with the updated port number passed as a URL query parameter
Cevap
HTTP PATCH with a payload containing only the port number key-value pair
In REST-based API design, the HTTP PATCH method is used to perform partial updates on an existing resource. When sending a PATCH request, the body contains only the specific key-value pairs that need to be changed, leaving all unmentioned parameters in their current state on the server.
Adım Adım Çözüm
Anahtar Kavram
HTTP PATCH vs. PUT operations in REST APIs