Bird
0
0

A PATCH request to update a user's phone number fails with a 400 Bad Request error. The JSON body is:

medium📝 Debug Q7 of 15
Rest API - HTTP Methods
A PATCH request to update a user's phone number fails with a 400 Bad Request error. The JSON body is:
{"phone": 1234567890}

What is the likely issue?
AThe URL is missing the user ID.
BPATCH requests cannot update phone numbers.
CThe server does not support PATCH method.
DThe phone number should be a string, not a number.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze JSON data type

    Phone numbers are often expected as strings to preserve formatting.
  2. Step 2: Check server validation

    Sending phone as number may cause validation error, leading to 400 Bad Request.
  3. Final Answer:

    The phone number should be a string, not a number. -> Option D
  4. Quick Check:

    Data type mismatch causes 400 error [OK]
Quick Trick: Send phone numbers as strings in JSON [OK]
Common Mistakes:
  • Sending phone as number instead of string
  • Assuming PATCH can't update phone
  • Ignoring URL correctness

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes