Bird
0
0

A REST API incorrectly uses POST to retrieve data instead of GET. What problem does this cause?

medium📝 Debug Q7 of 15
Rest API - REST API Fundamentals
A REST API incorrectly uses POST to retrieve data instead of GET. What problem does this cause?
AViolates statelessness by storing client state.
BViolates cacheable responses by caching POST results.
CViolates safe method constraint, causing unexpected side effects.
DViolates layered system by bypassing proxies.
Step-by-Step Solution
Solution:
  1. Step 1: Understand safe methods in REST

    GET is safe (no side effects), POST is not safe (may change state).
  2. Step 2: Identify issue with using POST to retrieve

    Using POST to get data breaks safe method constraint, risking side effects.
  3. Final Answer:

    Violates safe method constraint, causing unexpected side effects. -> Option C
  4. Quick Check:

    POST for retrieval breaks safe method rule [OK]
Quick Trick: GET is safe; POST can cause side effects [OK]
Common Mistakes:
MISTAKES
  • Confusing statelessness with safe methods
  • Assuming POST results are cached
  • Thinking proxies are involved here

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes