-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link vs Location #57
Comments
I'm not sure what it should be, but I agree that it shouldn't be We don't have async Jobs, or use 202 yet. Microsoft Guides, which I propose we follow if/when we implement such functionality, talks about 202 and uses the non-standard |
@StevenXL I think we should decide if we want to follow the MS Guide as-is, or follow the MS Guide + that open Issue. And then I will fix the our Guide. There are 3 kinds of long running operations responses being discussed: PUT, POST, and POST+hybrid. I'll refer to PUT and POST as Normal here, since that distinction doesn't matter in this discussion. Normal would be a request that leads to creation of something that you have to wait for, as you might guess. Hybrid means that some resource was created right away, but it's not ready. Imagine a request to create and then migrate a database. The DB is created, but you are waiting on the migration operation.
My understanding of the benefits of (1) is:
My understanding of the benefits of (2) is:
The other factor is that the open Issue has been open for over 2 years. I fear it may never close, despite its popularity, due to the backwards-compatibility concern. @eborden any thoughts? We actually implemented our first API using this pattern, but we sort of missed on the response spec. What ended up happening was we return a 200 with body |
Status202 is the correct status to use here. The response has been accepted, but the product of that response is not yet processed. Header
My Opinion
|
Awesome, thanks for the thoughts. Let me repeat some of what you said back, to make sure I understand: You're suggesting we don't follow either version of the MS Guides on this point. Option (1) misuses 201 and (2) misuses an (albeit Standard) HTTP header. And these are reason enough to go off-Guide. You're not proposing anything for the Hybrid case, which I take to mean we leave it unspecified until/unless we have one.
You're fully disagreeing with the way MS is interpreting the HTTP spec for the Hybrid flow, where (they say) the product of the response has been created (hence 201 + I have no real issues with using I am a little wary on this point:
which could be restated as, "forcing you to define a domain specific grammar". But I like sharp tools, so I could get behind it. Hopefully the
If we took this view, we end up with:
Which, IMO, is simple, clear, and easy for a Frontend client to work with. It also happens to be (2), if you never have a Hybrid use-case. This was my original preference, because I didn't fully appreciate the Hybrid case and basically ignored it. My opinion has changed a bunch while thinking about this, but I think I'm landing at using the MS Guide as-is, so (1). Reasons being,
The thought of this discussion ending with "do our own thing", effectively hand-cuffing us into future discussions, feels like a big downside. If instead this discussion ended with "follow that Guide", we're done here. And I believe that guide is plenty reasonable enough to follow, which is of course a prerequisite to that stance. This is especially true for the Hybrid flow. We don't have any today, but when we do we'll need to re-open this topic all over again. Seems a little unnecessary when there's a ready-made pattern right there. |
I'm super curious about why they differentiate in the hybrid use-case. Nothing in the HTTP spec says you can't return a body for a 202.
Let me decouple my own opinions and disagreements with what is pragmatic.
|
Oh and by "we should just follow the guide" I mean in its current form. We shouldn't attempt to project the outcome of an active discussion. |
In case you missed it, I was introduced to this Guide through the RL Architects. RL APIs aspire to follow this exact guide. This is really why following this one in particular appeals to me. There are caveats though:
|
If there is no objection from @StevenXL in the next day or so, I'm going to open a PR that updates that Status Code section to say something like:
And link it to the relevant section in the MS Guide, implying we should be following it as-is. I plan to incorporate and link out to the MS Guide more from this Guide, as appropriate. See #61. |
Sounds good! |
After reading the comments, I agree with PR #61. The benefits of delegating any future discussion to MS Guide is a large benefit. PR good to go. |
In Status Codes, should "202 for async jobs (with Link header)" read "202 for async jobs (with Location header)"?
The text was updated successfully, but these errors were encountered: