0

I have the following API defined in my config spec:

"paths": {
  "/handler/v1/fetch/{mode}": {
   "post": {
    "operationId": "ApihandlerFetch",
    "parameters": [
     {
      "name": "mode",
      "in": "path",
      "required": true,
      "type": "string"
     },
     {
      "name": "y",
      "in": "query",
      "required": false,
      "type": "integer",
      "format": "int32"
     },
     {
      "name": "m",
      "in": "query",
      "required": false,
      "type": "integer",
      "format": "int32"
     },
     {
      "name": "d",
      "in": "query",
      "required": false,
      "type": "integer",
      "format": "int32"
     }
    ],

The following curl requests fails with the error message "global.badrequest"

curl -d '{}' "https://xxxxx.appspot.com/_ah/api/handler/v1/fetch/latest"

 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "badRequest",
    "message": "java.lang.IllegalArgumentException"
   }
  ],
  "code": 400,
  "message": "java.lang.IllegalArgumentException"
 }
}

It however works when the other query parameters are defined with a value like so:

curl -d '' "https://xxxx.appspot.com/_ah/api/handler/v1/fetch/date?y=2017&m=11&d=27"

Did I misunderstood the whole idea of a Query Parameter in Google App Engine Endpoints framework v2, and that the parameters should be part of the URL regardless if they have a value or not (ie: http://...?y=&m=&d).

4

0 回答 0