--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group, send email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
I personally also give a 200 with a 'processing' representation.
--
I guess my point is that in this scenario, the original poster
described the temporary status resource as having the same
representation as what the final resource hoped to have.
Ah, yes.OTOH since he's blogging about it I do wonder if that's not a very limited set of applicable use-cases such that it might not be a good idea to represent it as a general pattern? How many scenarios can provide the same representation as the authority? (I don't have a set opinion on this, I'm asking for others experience too.)BTW, I realized after I posted that 203 might be better alternative than 204 in my proposed alternative.z
From an HTTP
point of view, the client probably ought not to be able to distinguish
the "temporary" location from the "final" location, URL-wise, so
what's described here is perfectly fine from an HTTP point of view.
It's the same representation, but not the same resource identity (URL), right? Wouldn't that potentially cause problems for selected client's use-cases?Also, this means that the representation cannot contain hypermedia links that only the source would know, right?
The only downside is that the intermediary in this point might be
committed to maintaining the temporary URL with a 301 for some period
of time (perhaps indefinitely) after the "real" location got created.
This may or may not be problematic.
Agreed.
As an alternative, you could serve a 503 with 'Retry-After: 5' and
'Cache-Control: max-age=5' at the intermediary while it is in the
pending state, then proceeding with either a 301 on success or some
other 5XX error on failure. This has the benefit of not depending on
any particulars of the representation returned with these responses:
the semantics are clearly and entirely specified within the HTTP spec
itself.
Hmm. Would not have occurred to me to return a "Server Error" for this, but I can see that 503's semantics are otherwise appropriate.I wonder if serving a 5xx could potentially trigger broader server handling upstream that would not be appropriate for this use-case? Again, these are questions, not opinions.
You have successfully initiated the creation of a resource. That it's
undergoing some sort of internal change is not particularly relevant.
How then does the client distinguish between "I'm done" and "I have to request again?"
Ah, subtle point. I suggested returning a 201 to the initial creation
request, not a 202. In other words, "ok, I created your resource, here
it is." Once the background request completed, then it says "oh, by
the way, I'm over there now, and don't bother coming back to this
location" (301 Moved Permanently). So the resource on the intermediary
isn't a "processing/status" resource per se, but rather the result of
the initial creation request.