Skip to content
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

Potential alternative to the new "Operation-Location" header #10

Open
darrelmiller opened this issue Jul 19, 2016 · 5 comments
Open

Potential alternative to the new "Operation-Location" header #10

darrelmiller opened this issue Jul 19, 2016 · 5 comments

Comments

@darrelmiller
Copy link
Member

ref: https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md#1321-put

For long running operations that return 202, it is suggested to use Operation-Location to refer to a resource that can be monitored to determine when the requested operation is complete. Although, not explicitly specified by the HTTP spec, it is common practice to use the Location header to point to this status monitoring resource. See RFC7240 and RESTful Web Services Cookbook

It would seem prudent to follow common practice and avoid creating a new non-standard header for something that is commonly done.

For the hybrid scenario where the Location header is used to refer to the partially created resource and the Operation-Location header is used to point to the status resource, an alternative would be the following response:

HTTP/1.1 202 Accepted
Location: https://api.contoso.com/v1.0/operations/123
Content-Location: https://api.contoso.com/v1.0/databases/db1
{
  "databaseName": "db1",
  "color": "red",
  "Status": "Provisioning",
  [ … other fields for "database" …]
}

This approach is consistent with it's use of 202 to indicate that the creation process has not completed. It continues to use the Location header to indicate the location of the status monitoring resource. However, it also uses the Content-Location header to indicate that there is a response body that represents the current state of the resource being created and provides a URL to the final destination of the resource.

This approach provides equivalent functionality but doesn't require inventing a new header, it follows current common practices and it avoids having to impose the rules that the hybrid 201 must a have a
body, and it must indicate that it is incomplete, and that 202 responses shouldn't return a body.

@garethj-msft
Copy link
Member

I really like this proposal. I'm circulating it internally to see what reaction we have to changing to this as our preferred guidance.

@jmealo
Copy link

jmealo commented Jun 23, 2017

Any updates on this? (For what it's worth, I agree with the proposal.)

@darrelmiller
Copy link
Member Author

I guess I should write a PR. /cc Thoughts? @garethj-msft @RobDolinMS @markdstafford

@freeranger
Copy link

@garethj-msft What was the internal reaction to this proposal?

@letmaik
Copy link
Member

letmaik commented Nov 27, 2020

@darrelmiller @garethj-msft Could you please add a final statement and close issues and PRs that have been abandoned? If this issue is indeed still actively under discussion then a status update would be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants