nerdexam
Cisco

200-901 · Question #13

A developer is writing an application that uses a REST API and the application requires a valid response from the API. Which element of the response is used in the conditional check?

The correct answer is B. Status code. The HTTP status code is the standard mechanism for determining whether an API call succeeded or failed. Codes in the 2xx range (e.g., 200 OK, 201 Created) indicate success, while 4xx (client errors) and 5xx (server errors) indicate failure. A developer's conditional logic…

Understanding and Using APIs

Question

A developer is writing an application that uses a REST API and the application requires a valid response from the API. Which element of the response is used in the conditional check?

Options

  • AURL
  • BStatus code
  • CLink
  • DBody
  • EHeaders

How the community answered

(47 responses)
  • A
    2% (1)
  • B
    91% (43)
  • D
    4% (2)
  • E
    2% (1)

Explanation

The HTTP status code is the standard mechanism for determining whether an API call succeeded or failed. Codes in the 2xx range (e.g., 200 OK, 201 Created) indicate success, while 4xx (client errors) and 5xx (server errors) indicate failure. A developer's conditional logic (e.g., if response.status_code == 200) is based on this value. The URL (A) is part of the request, not the response. The body (D) contains the payload but is only safely parsed after confirming success via the status code. Headers (E) and links (C) carry metadata but are not the primary indicator of success or failure.

Topics

#REST API#HTTP Status Codes#API Response Handling

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice