Practice API error handling vocabulary: error response shape, RFC 7807 Problem Details, idempotency key, Retry-After header, and surfacing upstream errors.
0 / 22 completed
1 / 22
What does RFC 7807 Problem Details define?
RFC 7807 defines a standard JSON (and XML) format for HTTP API errors. The 'type' is a URI identifying the error class, 'title' is a short description, 'status' is the HTTP status code, 'detail' is a human-readable explanation, and 'instance' is a URI for the specific occurrence.
2 / 22
What is an 'idempotency key' and why do APIs use it?
An idempotency key lets clients safely retry requests — especially important for payment APIs. If the same idempotency key is seen twice, the server returns the original response without processing the operation again, preventing double charges.
3 / 22
An API responds with a 'Retry-After' header. What should the client do?
The Retry-After header, typically sent with 429 Too Many Requests or 503 Service Unavailable, tells clients how long to wait before retrying. Clients should respect this value to avoid worsening rate limit or overload situations.
4 / 22
A colleague says 'we surface the upstream error.' What does this mean in an API context?
'Surfacing the upstream error' means the API relays the error received from a downstream service (like a payment processor or database) to the caller — either verbatim or lightly wrapped — rather than returning a generic 500 that hides the root cause.
5 / 22
What is the 'error response shape' in API design?
The error response shape is the agreed structure of all error payloads from an API. Consistency matters: clients should be able to handle any error from the API using the same parsing logic, regardless of which endpoint generated it.
6 / 22
Reviewer: 'The `createUser` endpoint is returning a 409 Conflict with a Problem Details that says 'Resource already exists'. This should be handled more gracefully – perhaps by logging the attempt and returning a 429 Too Many Requests to the client instead of throwing an exception. It's confusing for the front-end team.'
Which of the following best describes the reviewer's concern and suggested approach?
The reviewer's suggestion of a 429 Too Many Requests response is crucial because a 409 Conflict signifies a *resource contention* issue – the resource already exists. Returning a 429 signals to the client that they should implement retry logic with a delay (e.g., exponential backoff) which is a standard pattern for handling transient errors like this. Simply returning an exception or displaying a generic error message doesn't address the underlying problem and can lead to poor user experience. Options A, C, and D misinterpret the 409 response and don't align with best practices for API error handling.
7 / 22
Slack Message: @john.doe 'The API keeps throwing a 409 error when I try to create a new product. The Problem Details say 'Resource already exists'. It's really confusing for the UI team because they don't know how to handle it.'
Which of the following best describes John Doe's issue and the most appropriate response from a technical lead?
John is encountering a typical scenario where an API returns a 409 Conflict when attempting to create a resource that already exists. The key here isn't just reporting the error but understanding *why* it's happening and how to handle it effectively. Returning a 429 Too Many Requests (as suggested) is a good approach for rate limiting and providing the front-end team with guidance on retry behavior, aligning with best practices for API design and error handling.
8 / 22
Code Review Comment
Reviewer: 'The updateProfile endpoint is returning a 400 Bad Request with a Problem Details that says 'Invalid input data'. The client isn't providing any specific validation errors, just this generic message. This makes it incredibly difficult for the front-end team to debug and guide the user on what needs to be corrected.'
The reviewer's concern centers around the lack of specific validation information within the 400 Bad Request response. A well-designed API should provide granular detail about what went wrong with the input data – this is crucial for front-end debugging and user experience. Returning a generic 'Invalid input data' message without further context hinders effective error handling and makes it difficult to guide the user toward correction. ErrorResponse objects are designed for exactly this purpose.
9 / 22
Reviewer: 'The `createUser` endpoint is returning a 409 Conflict with a Problem Details that says 'Resource already exists'. This should be handled more gracefully – perhaps by logging the attempt and returning a 429 Too Many Requests to the client instead of throwing an exception. It's confusing for the front-end team.'
Which of the following best describes the reviewer's concern and suggested approach?
The reviewer's suggestion of a 429 Too Many Requests response is crucial because a 409 Conflict signifies a *resource contention* issue – the resource already exists. Returning a 429 signals to the client that they should implement retry logic with a delay (e.g., exponential backoff) which is a standard pattern for handling transient errors like this. Simply returning an exception or displaying a generic error message doesn't address the underlying problem and can lead to poor user experience. Options A, C, and D misinterpret the 409 response and don't align with best practices for API error handling.
10 / 22
Slack Message: @john.doe 'The API keeps throwing a 409 error when I try to create a new product. The Problem Details say 'Resource already exists'. It's really confusing for the UI team because they don't know how to handle it.'
Which of the following best describes John Doe's issue and the most appropriate response from a technical lead?
John is encountering a typical scenario where an API returns a 409 Conflict when attempting to create a resource that already exists. The key here isn't just reporting the error but understanding *why* it's happening and how to handle it effectively. Returning a 429 Too Many Requests (as suggested) is a good approach for rate limiting and providing the front-end team with guidance on retry behavior, aligning with best practices for API design and error handling.
11 / 22
Code Review Comment
Reviewer: 'The updateProfile endpoint is returning a 400 Bad Request with a Problem Details that says 'Invalid input data'. The client isn't providing any specific validation errors, just this generic message. This makes it incredibly difficult for the front-end team to debug and guide the user on what needs to be corrected.'
The reviewer's concern centers around the lack of specific validation information within the 400 Bad Request response. A well-designed API should provide granular detail about what went wrong with the input data – this is crucial for front-end debugging and user experience. Returning a generic 'Invalid input data' message without further context hinders effective error handling and makes it difficult to guide the user toward correction. ErrorResponse objects are designed for exactly this purpose.
12 / 22
Reviewer: 'The `createUser` endpoint is returning a 409 Conflict with a Problem Details that says 'Resource already exists'. This should be handled more gracefully – perhaps by logging the attempt and returning a 429 Too Many Requests to the client instead of throwing an exception. It's confusing for the front-end team.'
Which of the following best describes the reviewer's concern and suggested approach?
The reviewer's suggestion of a 429 Too Many Requests response is crucial because a 409 Conflict signifies a *resource contention* issue – the resource already exists. Returning a 429 signals to the client that they should implement retry logic with a delay (e.g., exponential backoff) which is a standard pattern for handling transient errors like this. Simply returning an exception or displaying a generic error message doesn't address the underlying problem and can lead to poor user experience. Options A, C, and D misinterpret the 409 response and don't align with best practices for API error handling.
13 / 22
Slack Message: @john.doe 'The API keeps throwing a 409 error when I try to create a new product. The Problem Details say 'Resource already exists'. It's really confusing for the UI team because they don't know how to handle it.'
Which of the following best describes John Doe's issue and the most appropriate response from a technical lead?
John is encountering a typical scenario where an API returns a 409 Conflict when attempting to create a resource that already exists. The key here isn't just reporting the error but understanding *why* it's happening and how to handle it effectively. Returning a 429 Too Many Requests (as suggested) is a good approach for rate limiting and providing the front-end team with guidance on retry behavior, aligning with best practices for API design and error handling.
14 / 22
Code Review Comment
Reviewer: 'The updateProfile endpoint is returning a 400 Bad Request with a Problem Details that says 'Invalid input data'. The client isn't providing any specific validation errors, just this generic message. This makes it incredibly difficult for the front-end team to debug and guide the user on what needs to be corrected.'
The reviewer's concern centers around the lack of specific validation information within the 400 Bad Request response. A well-designed API should provide granular detail about what went wrong with the input data – this is crucial for front-end debugging and user experience. Returning a generic 'Invalid input data' message without further context hinders effective error handling and makes it difficult to guide the user toward correction. ErrorResponse objects are designed for exactly this purpose.
15 / 22
Reviewer: 'The `createUser` endpoint is returning a 409 Conflict with a Problem Details that says 'Resource already exists'. This should be handled more gracefully – perhaps by logging the attempt and returning a 429 Too Many Requests to the client instead of throwing an exception. It's confusing for the front-end team.'
Which of the following best describes the reviewer's concern and suggested approach?
The reviewer's suggestion of a 429 Too Many Requests response is crucial because a 409 Conflict signifies a *resource contention* issue – the resource already exists. Returning a 429 signals to the client that they should implement retry logic with a delay (e.g., exponential backoff) which is a standard pattern for handling transient errors like this. Simply returning an exception or displaying a generic error message doesn't address the underlying problem and can lead to poor user experience. Options A, C, and D misinterpret the 409 response and don't align with best practices for API error handling.
16 / 22
Slack Message: @john.doe 'The API keeps throwing a 409 error when I try to create a new product. The Problem Details say 'Resource already exists'. It's really confusing for the UI team because they don't know how to handle it.'
Which of the following best describes John Doe's issue and the most appropriate response from a technical lead?
John is encountering a typical scenario where an API returns a 409 Conflict when attempting to create a resource that already exists. The key here isn't just reporting the error but understanding *why* it's happening and how to handle it effectively. Returning a 429 Too Many Requests (as suggested) is a good approach for rate limiting and providing the front-end team with guidance on retry behavior, aligning with best practices for API design and error handling.
17 / 22
Code Review Comment
Reviewer: 'The updateProfile endpoint is returning a 400 Bad Request with a Problem Details that says 'Invalid input data'. The client isn't providing any specific validation errors, just this generic message. This makes it incredibly difficult for the front-end team to debug and guide the user on what needs to be corrected.'
The reviewer's concern centers around the lack of specific validation information within the 400 Bad Request response. A well-designed API should provide granular detail about what went wrong with the input data – this is crucial for front-end debugging and user experience. Returning a generic 'Invalid input data' message without further context hinders effective error handling and makes it difficult to guide the user toward correction. ErrorResponse objects are designed for exactly this purpose.
18 / 22
Reviewer: 'The getProduct endpoint is returning a 404 Not Found with a Problem Details that says 'Resource not found'. The client isn't handling this case gracefully. Suggest an improvement in the PR description.' What does the reviewer likely mean when they say 'handle this case gracefully'?
The reviewer suggests returning a standard 404 response. This aligns with HTTP best practices for indicating a resource is not found. Options A and B propose approaches that are less conventional or potentially problematic in API design – circuit breakers aren't always appropriate and overly verbose error messages can be confusing. Option C would mask the underlying issue, while option D would halt application flow.
19 / 22
@sarah.lee: 'The API is consistently returning a 500 Internal Server Error when processing large image uploads. The Problem Details indicate 'Timeout during upload'. We need to investigate the backend server's resource limits.' What does Sarah mean by 'resource limits'?
Sarah refers to 'resource limits' in the context of a server. Specifically, she means the amount of memory allocated to the process handling the image upload – this is what would cause a timeout when processing large files. Options A and C refer to request size or concurrency, while option D relates to storage capacity.
20 / 22
'I'm working on improving the error handling for the updateUser endpoint. Currently, it returns a 400 Bad Request with a Problem Details that says 'Invalid email format'. I'm adding input validation to ensure emails are in a valid format before processing. This should help prevent these errors.' What is the primary goal of this change?
The core objective is to reduce the number of 400 Bad Request responses. Input validation is a standard technique for preventing invalid data from reaching the server and causing errors. While better error messages might be helpful later, the immediate focus is on addressing the symptom (invalid email format) rather than the root cause.
21 / 22
The following API response was received: { "status": 422, "error": "Unprocessable Entity", "details": [{"field":"productName","code":"invalid_format"}, {"field":"price","code":"must_be_numeric"}] }. What does the 'details' field in this response indicate?
The 'details' field provides granular information about *which* fields in the request failed validation and the specific codes associated with those failures. This allows the client to pinpoint exactly what needs to be corrected, rather than receiving a generic error message. The status code indicates the overall problem type (unprocessable entity).
22 / 22
A developer is struggling with consistently encountering a 502 Bad Gateway error when calling a third-party API. The documentation states that the API occasionally experiences temporary outages. What should the developer do to mitigate this issue?
Exponential backoff with jitter is the standard approach for handling intermittent service outages. This technique involves retrying the request after a delay, increasing the delay with each attempt (jitter) to avoid overwhelming the failing service. Option A is premature escalation; option C is unwise and potentially harmful; and option D is irrelevant.
What will I practice in "API Error Handling Vocabulary Quiz"?
This is an API Design Language exercise set. It walks through 22 scenario-based multiple-choice questions built around real usage of API Design Language terminology that IT professionals encounter on the job.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free to complete with no account, sign-up, or paywall.
How many questions are in this exercise?
This set contains 22 questions. Each one shows immediate feedback and a detailed explanation after you answer, so you learn the correct usage right away rather than waiting for a final score.
Do I need prior experience to complete this exercise?
No prior experience is required. Each question includes a full explanation covering the reasoning behind the correct answer, so the exercise itself teaches the API Design Language vocabulary as you go.
Can I retry the exercise if I get questions wrong?
Yes — use the "Try again" button on the results screen to reset your answers and go through all the questions again. There is no limit on attempts.
Is my progress saved?
Your answers and score for the current session are tracked in the browser as you go. No account or login is needed, and there is nothing to install.
What if I don't understand a term used in a question?
Read the explanation shown after you answer each question — it breaks down the correct term in plain English with a real-world example. You can also check the site Glossary for quick definitions.
How is this different from reading a blog article on the topic?
Exercises like this one are interactive drills that test and reinforce specific vocabulary through multiple-choice questions, while blog articles explain concepts in prose. Practising here after reading builds active recall, not just passive recognition.
Where can I find more API Design Language exercises?
See the API Design Language exercises hub for the full set of related pages, or browse all exercise categories from the main Exercises index.
Can I use this exercise to prepare for a technical interview?
Yes — API Design Language vocabulary comes up often in technical discussions and interviews. Pair this exercise with our dedicated Interview Preparation section for role-specific practice.