Repeated type in query on REST API over gRPC

Viewed 18

I am currently making REST API over gRPC. The generated REST API url doesnt look good, so I want to know how to resolve the issue.

ISSUE

Currently I have these Protobuf

message GetBookTitleListRequest {
  repeated int32 book_ids = 1;
}

message GetBookTitleListResponse {
  repeated string book_titles = 1;
}
rpc GetBookTitles(GetBookTitleListRequest) returns GetBookTitleListResponse {
  option (google.api.http) = {
    get: 'api/v1/books/titles'
  };
}

I can specify the book ids in GetBookTitleListRequest and API returns the list of book titles.

The generated api looks like this if I want book titles with id (1, 2, 3) localhost:8000/api/v1/books/titles?book_ids=1&book_ids=2&book_ids=3.

However, I want it be like localhost:8000/api/v1/books/titles?book_ids=1,2,3.

Is it possible to do this?

0 Answers
Related