DevNet Associate (DEVASC) v1.0Understanding and Using APIsHard

A network engineer is using Postman to test a new REST API endpoint on a Cisco device. The API expects `application/yang-data+json` as the `Content-Type` for requests that modify configuration. The engineer sends a POST request with a JSON payload, but the API rejects it with an HTTP 415 Unsupported Media Type error. What is the most likely reason for this error?

  1. AThe `Content-Type` header in the request is incorrectly set, likely to `application/json` instead of `application/yang-data+json`.
  2. BThe API endpoint requires an `Authorization` header which is missing or invalid.
  3. CThe `Accept` header in the request does not include `application/yang-data+json`.
  4. DThe JSON payload sent in the request body is syntactically incorrect.
Show answer & explanation

Correct answer: A. The `Content-Type` header in the request is incorrectly set, likely to `application/json` instead of `application/yang-data+json`.

An HTTP 415 Unsupported Media Type error indicates that the server is refusing to accept the request because the payload format (specified by the `Content-Type` header) is not supported. In this case, the API explicitly expects `application/yang-data+json`, so sending `application/json` would cause this error.

Why the other options are wrong

  • B. A missing or invalid `Authorization` header would result in a `401 Unauthorized` or `403 Forbidden` error, not `415 Unsupported Media Type`.
  • C. The `Accept` header indicates what the client *wants to receive*, not what it *sends*. A `415` error relates to what the server *received* in the request body.
  • D. Syntactically incorrect JSON would typically result in a 400 Bad Request error, not 415 Unsupported Media Type.

HTTP 415 Unsupported Media Type

The HTTP `415 Unsupported Media Type` client error response code indicates that the server refuses to accept the request because the payload format is not supported by the server for this method and target resource. This is typically due to an incorrect or missing `Content-Type` header in the request.

  • Server rejects request due to unsupported payload format.
  • Caused by incorrect `Content-Type` header in the request.
  • Specific to the request body's media type.
  • Often seen with RESTCONF or other specialized APIs expecting specific JSON/XML variants.

Memory trick: 415 means Content-Type is Wrong for the Server's taste.

More Understanding and Using APIs questions