From f93e871b4d62a0bd10018fa202a35e7196edd992 Mon Sep 17 00:00:00 2001 From: Olivier Cano Date: Sun, 7 Jun 2026 15:36:09 +0200 Subject: [PATCH] feat(231): allow `POST` HTTP verb Signed-off-by: Olivier Cano --- aep/general/0231/aep.md.j2 | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/aep/general/0231/aep.md.j2 b/aep/general/0231/aep.md.j2 index d5c7b1ad..39ff3f26 100644 --- a/aep/general/0231/aep.md.j2 +++ b/aep/general/0231/aep.md.j2 @@ -10,14 +10,15 @@ APIs **may** support batch get to retrieve a consistent set of resources. - The method's name **must** begin with `BatchGet`. The remainder of the method name **must** be the plural form of the resource being retrieved. -- The HTTP verb **must** be `GET`. +- The HTTP verb **must** be `GET` or `POST`. - The HTTP URI **must** end with `:batch-get`. - The URI path **must** represent the collection for the resource, matching the collection used for simple CRUD operations. If the operation spans parents, a [wilcard](./reading-across-collections) **may** be accepted. -- There **must not** be a request body. +- When the HTTP verb is `GET`, there **must not** be a request body. - If a GET request contains a body, the body **must** be ignored, and **must not** cause an error. +- When the HTTP verb is `POST`, there **must** be a request body. ### Request @@ -45,7 +46,8 @@ pattern: ```proto rpc BatchGetBooks(BatchGetBooksRequest) returns (BatchGetBooksResponse) { option (google.api.http) = { - get: "/v1/{parent=publishers/*}/books:batch-get" + post: "/v1/{parent=publishers/*}/books:batch-get" + body: "*" }; } @@ -55,7 +57,7 @@ message BatchGetBooksRequest { // If this is set, the parent of all of the books specified in `paths` // must match this field. string parent = 1 [ - (aep.api.field_info) = { resource_reference: [ "library.com/book" ], field_behavior: [ FIELD_BEHAVIOR_OPTIONAL ] } + (aep.api.field_info) = { resource_reference: [ "library.com/publisher" ], field_behavior: [ FIELD_BEHAVIOR_OPTIONAL ] } ]; // The paths of the books to retrieve. @@ -77,7 +79,8 @@ message BatchGetBooksRequest { - The field **should** identify the [resource type][aep-122-parent] that it references. - The comment for the field **should** document the resource pattern. -- There **must not** be a body key in the `google.api.http` annotation. +- When the HTTP verb is `GET`, there **must not** be a body key in the `google.api.http` annotation. +- When the HTTP verb is `POST`, there **must** be a body key in the `google.api.http` annotation. {% tab oas %} @@ -159,6 +162,13 @@ get either succeeds for all requested resources or fails. When supported, the method must define a boolean parameter `transactional` that the user must specify with the value `true` to request a transactional operation. +## Rationale + +### Why allowing both `POST` and `GET` HTTP verb? + +- Allowing the `POST` HTTP verb address practical limitations such as URL length constraints (e.g., 2048 characters). +- Allowing the `GET` HTTP verb maintains backward compatibility and cacheability. + ## Changelog - **2024-04-22:** Adopt from Google AIP https://google.aip.dev/231 with the