github.com/googleapis/api-linter@v1.65.2/docs/rules/0165/http-method.md (about) 1 --- 2 rule: 3 aip: 165 4 name: [core, '0165', http-method] 5 summary: Purge methods must use the POST HTTP verb. 6 permalink: /165/http-method 7 redirect_from: 8 - /0165/http-method 9 --- 10 11 # Purge methods: POST HTTP verb 12 13 This rule enforces that all `Purge` RPCs use the `POST` HTTP verb, as 14 mandated in [AIP-165][]. 15 16 ## Details 17 18 This rule looks at any message beginning with `Purge`, and complains 19 if the HTTP verb is anything other than `POST`. It _does_ check additional 20 bindings if they are present. 21 22 ## Examples 23 24 **Incorrect** code for this rule: 25 26 ```proto 27 // Incorrect. 28 rpc PurgeBooks(PurgeBooksRequest) returns (google.longrunning.Operation) { 29 option (google.api.http) = { 30 get: "/v1/{parent=publishers/*}/books:purge" // Should be `post:`. 31 }; 32 option (google.longrunning.operation_info) = { 33 response_type: "PurgeBooksResponse" 34 metadata_type: "PurgeBooksMetadata" 35 }; 36 } 37 ``` 38 39 **Correct** code for this rule: 40 41 ```proto 42 // Correct. 43 rpc PurgeBooks(PurgeBooksRequest) returns (google.longrunning.Operation) { 44 option (google.api.http) = { 45 post: "/v1/{parent=publishers/*}/books:purge" 46 body: "*" 47 }; 48 option (google.longrunning.operation_info) = { 49 response_type: "PurgeBooksResponse" 50 metadata_type: "PurgeBooksMetadata" 51 }; 52 } 53 ``` 54 55 ## Disabling 56 57 If you need to violate this rule, use a leading comment above the method. 58 Remember to also include an [aip.dev/not-precedent][] comment explaining why. 59 60 ```proto 61 // (-- api-linter: core::0165::http-method=disabled 62 // aip.dev/not-precedent: We need to do this because reasons. --) 63 rpc PurgeBooks(PurgeBooksRequest) returns (google.longrunning.Operation) { 64 option (google.api.http) = { 65 get: "/v1/{parent=publishers/*}/books:purge" 66 }; 67 option (google.longrunning.operation_info) = { 68 response_type: "PurgeBooksResponse" 69 metadata_type: "PurgeBooksMetadata" 70 }; 71 } 72 ``` 73 74 If you need to violate this rule for an entire file, place the comment at the 75 top of the file. 76 77 [aip-165]: https://aip.dev/165 78 [aip.dev/not-precedent]: https://aip.dev/not-precedent