Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7087763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:42:50+00:00 2026-05-28T07:42:50+00:00

I currently develop a task queue with a RESTful API. In order to handle

  • 0

I currently develop a task queue with a RESTful API.

In order to handle a task, a worker has to create a lease.

PUT .../leases

If the task queue has tasks available, this will succeed, a lease will be created and the server responds with status 201.

I am unsure how to handle this case when no tasks are available. It is not possible to create a lease, when no tasks are available. Which HTTP status code would be appropriate for this case?

  • 204 No Content – The client hasn’t made anything wrong, but there is no data.

  • 400 Bad Request – This is imho not applicable, as it means “the request could not be understood by the server”, which is not the case

In the meantime I thought that this approach might not be ideal. Either I use 503, as recommended of Brian and also backed by a passage of REST in practice, or I change the whole process.

I was thinking of leases which could be created tentatively. That means

  1. PUT to /leases
  2. Either create a lease, assign a task and respond with 201 or create a tentative lease and respond with 202
  3. Tentative leases will stay for some time. If tasks gets available, they are assigned to the tentative leases. If there is no task for a specific period of time, the lease gets deleted and the server will respond with 410
  4. The client should then start again with 1.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:42:51+00:00Added an answer on May 28, 2026 at 7:42 am

    Since the resource is controlled by the server and there’s nothing the client can do to influence the outcome, a 500-range code would be most appropriate.

    503 - Service Unavailable sounds right to me. It implies that the server has not got enough resources available to meet the needs of the request. You should probably also return a meaningful error in the body of the response to make it explicitly clear that it failed because no leases/tasks were available, but that might not be the case sometime in the future.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently develop a server application which has to receive serialized data from clients,
I'm currently assigned to a task to develop a software module to communicate with
Is there any google calendar api for iphone sdk, currently I develop an iphone
I currently develop with Django, but want to be ready when a future client
I currently develop an application in C# with framework .NET 3.5 SP1. In my
I'm currently learning to develop for the .net compact framework using c# in VS2008
I am currently planning to develop a music streaming application. And i am wondering
Here's my problem. I'm currently trying to develop a .Net Compact Framework 2.0 application
Currently I am using Netbeans to develop applications in Swing, but Netbeans is very
Currently, I'm trying to develop a rich internet application using Flash Builder 4 Beta

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.