Bird
0
0

When sending JSON data in a REST API request body, which HTTP header must be included to specify the content type?

easy📝 Conceptual Q2 of 15
Rest API - Request and Response Format
When sending JSON data in a REST API request body, which HTTP header must be included to specify the content type?
ACache-Control: no-cache
BAccept: text/html
CAuthorization: Bearer token
DContent-Type: application/json
Step-by-Step Solution
Solution:
  1. Step 1: Identify the header for content type

    The Content-Type header tells the server the format of the data in the request body.
  2. Step 2: Choose the correct MIME type for JSON

    For JSON data, the MIME type is application/json.
  3. Final Answer:

    Content-Type: application/json -> Option D
  4. Quick Check:

    Content-Type header must match data format [OK]
Quick Trick: Use Content-Type: application/json for JSON data [OK]
Common Mistakes:
  • Using Accept header instead of Content-Type
  • Omitting the Content-Type header
  • Setting Content-Type to text/plain

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes