A automated network management script receives an HTTP status code of 415 Unsupported Media Type after issuing a POST request containing a structured JSON body to a REST-based API endpoint on a Cisco controller. Which HTTP request header was missing or misconfigured in the client's request payload headers to cause this failure?
- Content-TypeAnswer
- BAccept
- CAuthorization
- DHost
Answer
The Content-Type header must be specified in the request to inform the server of the data format (such as application/json) being sent in the body.
The Content-Type request header indicates the media type (such as application/json or application/yang-data+json) of the entity-body sent to the recipient. When a client sends a POST, PUT, or PATCH request containing data but fails to include a supported Content-Type header, the server rejects the request with an HTTP 415 Unsupported Media Type status code.
Step-by-Step Solution
Key Concept
REST API HTTP Headers and Media Type Negotiation (Content-Type vs. Accept)