Question

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

A network automation engineer is designing Python scripts to interact with Cisco DNA Center and RESTCONF API endpoints for network configuration management. Which two statements accurately describe the characteristics and operational mechanics of HTTP verbs, headers, and data formats used in REST-based APIs? (Select two.)

  1. HTTP PUT requests are idempotent and replace the specified resource entirely with the request payload, whereas HTTP PATCH requests apply partial modifications to an existing resource.Answer
  2. B
    HTTP POST operations are inherently idempotent, making them safe to execute repeatedly with identical payloads without creating duplicate server resources.
  3. The Content-Type HTTP header informs the server of the data format contained in the request body, while the Accept header specifies the data format expected in the response.Answer
  4. D
    In JSON-encoded REST payloads, square brackets `[]` are used to define key-value dictionary objects, while curly braces `{}` represent ordered lists of items.

Answer

The two correct characteristics of REST-based APIs are: (1) HTTP PUT requests are idempotent and perform a full resource replacement while HTTP PATCH applies partial updates, and (2) the Content-Type header defines the request payload format while the Accept header defines the expected response format.
The statement regarding HTTP PUT being idempotent and replacing the resource fully while HTTP PATCH applies partial updates is correct, as PUT replaces the target entity entirely and repeating the request results in the same server state, whereas PATCH modifies only the specified attributes. Additionally, the statement regarding Content-Type specifying the request payload format and Accept specifying the desired response format is correct, as Content-Type tells the server how to parse the incoming payload while Accept expresses client preference for the returned payload encoding.

Step-by-Step Solution

1
Analyze HTTP verb behaviors (CRUD mapping and idempotency)
PUT maps to Update/Replace and is idempotent because re-sending the same payload produces the exact same state. PATCH maps to partial modification. POST maps to Create (or general execution) and is non-idempotent because multiple identical calls create multiple items.
Understanding idempotency and CRUD mapping prevents unintended duplicate resource creation in network automation scripts.
2
Evaluate HTTP header functions for payload data types
The Content-Type header informs the receiver how to parse the incoming request body (e.g., application/json), while the Accept header negotiates the response payload format desired by the client.
API gateways and controllers rely on these headers to decode request payloads and serialize response payloads correctly.
3
Verify JSON data structure syntax
In JSON syntax, `{}` defines an object comprising key-value pairs, whereas `[]` defines an array of values.
Parsing API responses or crafting valid configuration payloads requires correct identification of objects versus arrays.

Key Concept

Characteristics of REST-Based APIs (HTTP Verbs, Idempotency, Headers, and Data Formats)
Rate this question