Question

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

An engineer is developing a Python script to interact with the Cisco DNA Center REST API to audit device configurations and modify global settings. Which two statements accurately describe the operational characteristics of HTTP request headers and HTTP verbs used in this REST API environment?

  1. The Accept HTTP header specifies the media type (such as application/json) that the client expects to receive in the response from the server.Answer
  2. HTTP PUT operations are idempotent, meaning executing identical requests multiple times results in the same final state on the server.Answer
  3. C
    HTTP POST operations are idempotent because sending the exact same payload repeatedly will update the existing resource rather than creating duplicate entries.
  4. D
    The Content-Type request header informs the server which data format the client is willing to accept in the HTTP response body.

Answer

The statement explaining that the Accept header specifies the expected response format and the statement noting that HTTP PUT operations are idempotent are both correct.
The Accept HTTP header is used by the client during request negotiation to specify the payload format (e.g., JSON or XML) expected in the server response. Additionally, HTTP PUT operations are inherently idempotent; submitting the exact same request body multiple times produces the same server state as a single invocation.

Step-by-Step Solution

1
Analyze HTTP request headers for REST APIs
Content-Type specifies the format of the payload being sent in the request (e.g., application/json), while Accept specifies the media type the client expects in the server's response.
Headers define negotiation rules between the client and API server.
2
Analyze HTTP verb characteristics and idempotency
PUT (used to Create/Replace) and GET, DELETE, OPTIONS are idempotent. POST (used to Create subordinate resources) is non-idempotent because multiple identical calls produce side effects such as duplicate entries.
Idempotency defines whether making multiple identical calls alters the server state beyond the initial call.

Key Concept

HTTP headers (Content-Type vs Accept) and verb properties (Idempotency of PUT vs POST)
Rate this question