Bird
0
0

In a REST API, you want to temporarily redirect users but preserve the HTTP method (e.g., POST remains POST). Which status code should you use?

hard📝 Application Q9 of 15
Rest API - HTTP Status Codes
In a REST API, you want to temporarily redirect users but preserve the HTTP method (e.g., POST remains POST). Which status code should you use?
A301 Moved Permanently
B302 Found
C307 Temporary Redirect
D303 See Other
Step-by-Step Solution
Solution:
  1. Step 1: Understand redirect status codes and HTTP methods

    302 and 303 may change HTTP method to GET, but 307 preserves the original method.
  2. Step 2: Choose status code that preserves method temporarily

    307 Temporary Redirect is designed to preserve method during temporary redirect.
  3. Final Answer:

    307 Temporary Redirect -> Option C
  4. Quick Check:

    Preserve method on temporary redirect = 307 [OK]
Quick Trick: Use 307 to keep HTTP method on temporary redirect [OK]
Common Mistakes:
  • Using 302 which may change POST to GET
  • Confusing 303 with preserving method
  • Assuming 301 is temporary redirect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes