I'm just getting started with Google Cloud Endpoints. I'm trying to add a new method to the Echo example to simply use a GET instead of a POST. After deploying, it seems that the new API method can't be found. For the life of me, I can't figure it out.
Here is the java code for the new method called echo2. The HttpdMethod was changed from POST to GET and the msg argument was changed from a Message to a String.
@ApiMethod(name = "echo2",httpMethod = ApiMethod.HttpMethod.GET)
public Message echo2( @Named("msg") String msg, @Named("n") @Nullable Integer n )
{
logger.info( "echo2(): msg=" + msg + ", and n=" + n );
return doEcho( msg, n );
}
And here is the code that was added to openapi.json. I made two changes: i) The first parameter was changed to a query parameter ii) The first parameter was changed from a Message object (which just contains a string) to a String.
"/echo/v1/echo2": {
"get": {
"operationId": "Echo2",
"parameters": [
{
"name": "msg",
"in": "query",
"required": true,
"type": "string"
},
{
"name": "n",
"in": "query",
"required": false,
"type": "integer",
"format": "int32"
}
],
"responses": {
"200": {
"description": "A successful response",
"schema": {
"$ref": "#/definitions/Message"
}
}
}
}
},
I deploy this (to Google App Engine Standard), redeploy the openapi.json and run the curl below, the response is 404.
curl --request GET 'https://mytestapi.appspot.com/_ah/api/echo/v1/echo2?msg=hey' --header 'Accept: application/json' --header 'Content-Type: application/json'
What am I doing wrong?