github.com/googleapis/api-linter@v1.65.2/docs/rules/0152/http-method.md (about) 1 --- 2 rule: 3 aip: 152 4 name: [core, '0152', http-method] 5 summary: Run methods must use the POST HTTP verb. 6 permalink: /152/http-method 7 redirect_from: 8 - /0152/http-method 9 --- 10 11 # Run methods: POST HTTP verb 12 13 This rule enforces that all `Run` use the `POST` HTTP verb, as 14 mandated in [AIP-152][]. 15 16 ## Details 17 18 This rule looks at any RPCs with the name beginning with `Run`, and 19 complains if the HTTP verb is anything other than `POST`. 20 21 ## Examples 22 23 **Incorrect** code for this rule: 24 25 ```proto 26 // Incorrect. 27 rpc RunWriteBookJob(RunWriteBookJobRequest) returns (google.longrunning.Operation) { 28 option (google.api.http) = { 29 patch: "/v1/{name=publishers/*/writeBookJobs/*}:run" // Should be `post:`. 30 body: "*" 31 }; 32 option (google.longrunning.operation_info) = { 33 response_type: "RunWriteBookJobResponse" 34 metadata_type: "RunWriteBookJobMetadata" 35 }; 36 } 37 ``` 38 39 **Correct** code for this rule: 40 41 ```proto 42 // Correct. 43 rpc RunWriteBookJob(RunWriteBookJobRequest) returns (google.longrunning.Operation) { 44 option (google.api.http) = { 45 post: "/v1/{name=publishers/*/writeBookJobs/*}:run" 46 body: "*" 47 }; 48 option (google.longrunning.operation_info) = { 49 response_type: "RunWriteBookJobResponse" 50 metadata_type: "RunWriteBookJobMetadata" 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::0152::http-method=disabled 62 // aip.dev/not-precedent: We need to do this because reasons. --) 63 rpc RunWriteBookJob(RunWriteBookJobRequest) returns (google.longrunning.Operation) { 64 option (google.api.http) = { 65 patch: "/v1/{name=publishers/*/writeBookJobs/*}:run" 66 body: "*" 67 }; 68 option (google.longrunning.operation_info) = { 69 response_type: "RunWriteBookJobResponse" 70 metadata_type: "RunWriteBookJobMetadata" 71 }; 72 } 73 ``` 74 75 If you need to violate this rule for an entire file, place the comment at the 76 top of the file. 77 78 [aip-152]: https://aip.dev/152 79 [aip.dev/not-precedent]: https://aip.dev/not-precedent