Question

Difficulty: HardCharacteristics of REST-Based APIs (CRUD, HTTP Verbs, Data Formats)

A network engineer is configuring an automated Python script to manage network interfaces on a Cisco controller via a RESTful API. The script interacts with the URI endpoint `/api/v1/interfaces/GigabitEthernet0/1`. Which two statements accurately describe the behavior of HTTP verbs and headers when performing CRUD operations on this REST API endpoint?

  1. An HTTP PUT request requires a complete payload representing the resource, as any omitted fields may be cleared or restored to default values.Answer
  2. The Content-Type request header identifies the data format of the sent body, while the Accept header specifies the data format expected in the response.Answer
  3. C
    An HTTP PATCH request creates a new endpoint resource if the target URI does not exist, whereas HTTP POST is restricted to modifying existing resources.
  4. D
    HTTP POST maps directly to the CRUD Read operation and is classified as idempotent because repeated requests return identical resource states without side effects.

Answer

The two correct statements state that an HTTP PUT request requires a complete payload representing the resource because omitted fields may be cleared or reset, and that the Content-Type request header identifies the data format of the sent body while the Accept header specifies the format expected in the response.
The correct options accurately identify REST API characteristics: HTTP PUT performs a complete resource replacement, meaning any unmentioned fields in the payload will be reset or cleared on the target server. Additionally, the Content-Type request header informs the server of the payload format being transmitted, while the Accept header declares the media format requested in the server response.

Step-by-Step Solution

1
Analyze HTTP PUT verb behavior in REST APIs.
PUT is used for full resource replacements. Omitting resource attributes during a PUT call can cause the API server to delete or overwrite those attributes with default values.
Understanding verb semantics ensures configuration data is not accidentally wiped during updates.
2
Analyze HTTP request header roles.
Content-Type specifies the format of data in the outgoing HTTP payload (such as application/json), whereas Accept tells the server which format the client prefers for the incoming response.
Proper header usage guarantees proper payload serialization and content negotiation between API client and server.
3
Evaluate distractor statements regarding HTTP POST and PATCH.
HTTP POST creates resources (Create in CRUD) and is non-idempotent. HTTP PATCH applies partial updates to existing resources. HTTP GET handles Read operations.
Identifying incorrect CRUD mappings and verb characteristics eliminates wrong options.

Key Concept

Characteristics of REST HTTP Verbs, CRUD Operations, and HTTP Header Negotiation
Estimated Time:2m 0s
Rate this question