Passing list of boxed primitives to Google Cloud Endpoint

前端 未结 2 604
臣服心动
臣服心动 2021-01-15 19:29

I am struggling with Lists as method parameters at Google Cloud Endpoints.

The documentations says that

The supported parameter types are the foll

相关标签:
2条回答
  • 2021-01-15 19:47

    Please add @Nullable annotation to your method, that will turn your collection-type parameter from a path into a query parameter.

    https://developers.google.com/appengine/docs/java/endpoints/annotations#nullable

    0 讨论(0)
  • 2021-01-15 19:50

    A more direct way is to add a path property to the API_METHOD annotation and not include the List parameter in the path. As stated here: "If path is specified, parameters can be made query parameters by not including them in the path"

    In your case it should look like:

    @ApiMethod(name = "testMethod", path="testMethod" httpMethod = HttpMethod.POST)

    0 讨论(0)
提交回复
热议问题