Skip to content
Sharp

HTTP JSON APIs interview questions

API Versioning, Jackson ObjectMapper, JSON Serialization

27 questions with answers and explanations · 27 flashcards

Questions

  1. When defining API versioning strategies, what is a key benefit of using URL paths over HTTP headers?Multiple choiceMedium
  2. Why might an API client crash if JSON response shapes are not treated as strict contracts?Multiple choiceMedium
  3. Why might you choose to use an API gateway in conjunction with API versioning?Multiple choiceMedium
  4. In the context of Java's HttpClient, which method allows you to perform an asynchronous HTTP request?Multiple choiceMedium
  5. How can you ensure that a Java application using HttpClient does not suffer from resource exhaustion during network failures?Multiple choiceHard
  6. Why should an API version change when a field is renamed or removed?Multiple choiceHard
  7. Which of the following is a challenge when using URL path versioning for APIs?Multiple choiceHard
  8. What should the DTO-to-domain translation step usually do?Multiple choiceMedium
  9. Which of the following HTTP client timeout configurations is crucial for preventing resource exhaustion in a Java application?Multiple choiceMedium
  10. Which JSON mapping strategy is recommended for maintaining backward compatibility when updating an API?Multiple choiceEasy
  11. Which of the following is a non-breaking change when updating a JSON API?Multiple choiceEasy
  12. Why do teams use CompletableFuture for handling multiple asynchronous HTTP requests in Java in production code?Multiple choiceMedium
  13. What does the Jackson ObjectMapper class primarily assist with in Java applications?Multiple choiceEasy
  14. In an e-commerce application, how can using CompletableFuture improve the handling of multiple asynchronous HTTP requests?Multiple choiceMedium
  15. In Java's HttpClient, which method converts a synchronous request into an asynchronous one?Multiple choiceMedium
  16. When using Jackson's ObjectMapper, which annotation ensures that unexpected fields in a JSON response do not cause deserialization errors?Multiple choiceEasy
  17. How does using HTTP headers for API versioning provide flexibility?Multiple choiceHard
  18. Why is it essential to treat JSON response shapes as strict contracts?Multiple choiceMedium
  19. In the context of JSON APIs, what does it mean to treat response shapes as strict contracts?Multiple choiceEasy
  20. Why can using HTTP headers for API versioning become a problem in production code?Multiple choiceHard
  21. Which approach should be used to handle a breaking change in a JSON API response to avoid client crashes?Multiple choiceHard
  22. In API versioning, what is a potential drawback of using URL path versioning?Multiple choiceMedium
  23. Which strategy is most suitable for handling breaking changes in a JSON API without affecting existing clients?Multiple choiceHard
  24. When adding a new field to a JSON API response, which of the following strategies is the safest for backward compatibility?Multiple choiceEasy
  25. Why translate external JSON into boundary DTOs before domain objects?Multiple choiceEasy
  26. Why does the Jackson ObjectMapper class in Java matter in this design?Multiple choiceEasy
  27. How can you ensure an API client handles unexpected additional fields in a JSON response?Multiple choiceMedium