0
0
Rest APIprogramming~20 mins

Long-running operations (async responses) in Rest API - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Async Operation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
1:00remaining
What is the HTTP status code returned for an accepted long-running operation?
Consider a REST API that starts a long-running operation and immediately returns a response. What HTTP status code should the server return to indicate the request was accepted but processing is not complete?
A202 Accepted
B404 Not Found
C200 OK
D500 Internal Server Error
Attempts:
2 left
💡 Hint
Think about the status code that means the request is accepted but still processing.
Predict Output
intermediate
1:00remaining
What is the typical HTTP header used to provide the URL for checking operation status?
When a long-running operation is accepted, the server often provides a URL where the client can check the status. Which HTTP header is commonly used to provide this URL?
ALocation
BRetry-After
CContent-Type
DAuthorization
Attempts:
2 left
💡 Hint
This header tells the client where to find the resource or status.
Predict Output
advanced
1:30remaining
What is the expected JSON response when polling a long-running operation that is still in progress?
A client polls the status URL of a long-running operation. The operation is still running. What JSON response should the server return to indicate this?
Rest API
HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "InProgress"
}
A{ "status": "Unknown" }
B{ "status": "Failed", "error": "Timeout" }
C{ "status": "Completed", "result": {...} }
D{ "status": "InProgress" }
Attempts:
2 left
💡 Hint
The status should clearly say the operation is still running.
Predict Output
advanced
1:30remaining
What is the correct final JSON response when a long-running operation completes successfully?
After polling, the long-running operation finishes successfully. What JSON response should the server return?
Rest API
HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "Succeeded",
  "result": {
    "message": "Operation completed"
  }
}
A{ "status": "Failed", "error": "Timeout" }
B{ "status": "InProgress" }
C{ "status": "Succeeded", "result": { "message": "Operation completed" } }
D{ "status": "Cancelled" }
Attempts:
2 left
💡 Hint
The status should indicate success and include the result.
🧠 Conceptual
expert
2:00remaining
Which HTTP method is best suited for starting a long-running operation that creates a resource asynchronously?
You want to design a REST API where clients start a long-running operation that creates a new resource asynchronously. Which HTTP method should you use to start this operation?
AGET
BPOST
CPUT
DDELETE
Attempts:
2 left
💡 Hint
Think about which method is used to create resources or trigger actions.