0
0
Rest APIprogramming~20 mins

Media type versioning in Rest API - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Media Type Versioning Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:30remaining
What is the HTTP Content-Type header for version 2 of the API?
Given the following media type versioning scheme, what is the correct Content-Type header to request version 2 of the API?

application/vnd.example.api.v2+json
Aapplication/vnd.example.api.v2+json
Bapplication/vnd.example.api+json;version=2
Capplication/json;version=2
Dapplication/vnd.example.api.v1+json
Attempts:
2 left
💡 Hint
Look for the version number embedded directly in the media type string.
🧠 Conceptual
intermediate
1:30remaining
Why use media type versioning in REST APIs?
Which of the following is the main reason to use media type versioning in REST APIs?
ATo force clients to always use the latest API version automatically
BTo embed the version number in the URL path for easy routing
CTo allow clients to specify the API version via the Accept or Content-Type header
DTo avoid using HTTP headers and rely only on query parameters
Attempts:
2 left
💡 Hint
Think about how clients tell the server which version they want.
Predict Output
advanced
1:30remaining
What is the server response Content-Type for a request with Accept: application/vnd.example.api.v3+json?
If a client sends the header:
Accept: application/vnd.example.api.v3+json
What should the server respond with in the Content-Type header?
Aapplication/vnd.example.api+json
Bapplication/json
Capplication/vnd.example.api.v2+json
Dapplication/vnd.example.api.v3+json
Attempts:
2 left
💡 Hint
The server should match the version requested by the client.
Predict Output
advanced
1:30remaining
What error occurs if the client requests an unsupported media type version?
If a client sends:
Accept: application/vnd.example.api.v99+json
and the server only supports versions 1 to 3, what HTTP status code should the server return?
A406 Not Acceptable
B200 OK
C415 Unsupported Media Type
D404 Not Found
Attempts:
2 left
💡 Hint
Think about how servers respond when they cannot provide the requested media type.
🧠 Conceptual
expert
2:00remaining
What is a key advantage of media type versioning over URL versioning?
Which of the following best describes a key advantage of media type versioning compared to versioning via URL paths?
AIt forces clients to update URLs when switching versions
BIt allows multiple API versions to coexist on the same URL with content negotiation
CIt simplifies server routing by using different URLs for each version
DIt removes the need for HTTP headers entirely
Attempts:
2 left
💡 Hint
Consider how clients and servers handle multiple versions simultaneously.