W3C home > Mailing lists > Public > www-talk@w3.org > September to October 2011

Dealing with errors during asynchronous resource creation

From: Lubomir Rintel <lubo.rintel@gooddata.com>
Date: Thu, 08 Sep 2011 12:00:56 +0200
To: www-talk@w3.org
Message-ID: <1315476056.2796.70.camel@localhost.localdomain>
Hi Everyone,

I'm searching for a correct solution (not violating the HTTP protocol
and causing least possible confusion to client) to this problem:

I POST a structure with task description to a resource (say /res1) /res1
triggers creation of a resource, which can take a long time and can
potentially fail in the end, due problems in task description (user
fault), that can not be discovered upon the initial POST. I need a way
to communicate this error to the user in case creation fails or
resulting resource in case the execution succeeds.

Would this be correct?

1.) Initial POST to /res1 returns an URI /res2
2.) Subsequent GET or HEAD of /res2 return 202 until the task finishes
3a.) In case the execution succeeds, a GET or HEAD of /res2 returns 200
with task result as body
3b.) Otherwise make the /res2 go away and start returning 410 (or 404?)
and explaining what went wrong in the body?

Or is there a better way?

Thanks,
-- 
Lubomir Rintel (GoodData), phone: #7715
Received on Friday, 9 September 2011 12:31:15 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 9 September 2011 12:31:22 GMT