-
Notifications
You must be signed in to change notification settings - Fork 790
feat (AIP-136) Update guidance of billable stateless methods #1124
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
c9105e7
4871799
7fd7b34
c43b4c5
85f1829
4426da2
0bcef51
b2dcccc
dd59db2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| id: 136 | ||
| state: approved | ||
| created: 2019-01-25 | ||
| updated: 2023-03-02 | ||
| updated: 2023-05-31 | ||
| placement: | ||
| category: operations | ||
| order: 100 | ||
|
|
@@ -127,7 +127,6 @@ rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse) { | |
| - The URI **should** place both the verb and noun after the `:` separator | ||
| (avoid a "faux collection key" in the URI in this case, as there is no | ||
| collection). For example, `:translateText` is preferable to `text:translate`. | ||
| - Stateless methods **must** use `POST` if they involve billing. | ||
|
|
||
| ### Declarative-friendly resources | ||
|
|
||
|
|
@@ -174,8 +173,17 @@ RPC name itself causes confusion, and can even cause issues for client libraries | |
| which generate both synchronous and asynchronous methods to call the RPC in some | ||
| languages. | ||
|
|
||
| ### Choice of HTTP methods for stateless methods | ||
|
|
||
| Stateless method **should** use `GET` HTTP method for retrieval use cases due to | ||
| its cache-friendly nature. This can reduce the costs for both the server and the | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it might be worth elaborating: e.g. it's common for web browsers to cache GET requests, and it's understood by clients to be a cacheable response.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review! Can you elaborate a bit more on "and it's understood by clients to be a cacheable response" part? What does this mean? Specifically what is "it" referring to? Thanks!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, by "it" I was referring to the fact that GET methods are cacheable.
What I mean is HTTP clients often cache GET responses as GET implies that it's doing data retrieval: https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.1. Specficially:
So custom methods which are cacheable and send no payload should use GET.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I edited it again with a new commit. PTAL! |
||
| client. | ||
|
|
||
|
xdtdaniel marked this conversation as resolved.
|
||
| ## Changelog | ||
|
|
||
| - **2023-05-31:** Remove the guidance that stateless methods involving | ||
| billing should use POST. Clarify the choice of HTTP methods for stateless | ||
| methods. | ||
| - **2023-05-16:** Added prohibition of the term "async" within RPC names. | ||
| - **2023-05-09:** Adding guidance for POST and GET, require parent instead of | ||
| the resource singular. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.