AppEngine Google Cloud Endpoint - Not Detected

I am new to Python and Google AppEngine, but I had about 7 years of programming experience. I am also new to StackOverflow.

I’m trying to create a simple Google Cloud Endpoint API for my personal project, and also finish and upload the finished application to the Google App Engine.

Here are my endpoint API settings:

@endpoints.api(name='puzzle', version='v1', description='Puzzle Engine API') 

And methods:

 @endpoints.method( PuzzleMessage, PuzzleMessage, name='puzzle.generate', http_method='GET', path='generate' ) @endpoints.method( PuzzleMessage, PuzzleMessage, name='puzzle.solve', http_method='GET', path='solve' ) 

My app.yaml looks like this:

 handlers: - url: /favicon\.ico static_files: favicon.ico upload: favicon\.ico - url: .* script: main.app # Endpoints handler - url: /_ah/api/.* script: services.application libraries: - name: webapp2 version: "2.5.2" 

And finally, services.py reads:

 from google.appengine.ext import endpoints from api import puzzle_api application = endpoints.api_server([ puzzle_api.PuzzleAPI ], restricted=False) 

Now the problem is that when I try to reach https://my-app-name.appspot.com/_ah/api/discovery/v1/apis, all I see is

Not found

Also, when I am in the API API https://developers.google.com/apis-explorer/?base=https:// my-app-name.appspot.com/_ah/api#p/, the list Services is empty, and in the JavaScript console I see a 404 error at https://my-app-name.appspot.com/_ah/api/discovery/v1/apis.

Eliminating these URLs on the local test server gives completely different errors. When I try to get to the Discovery API on a local test server on localhost: 8080 / _ah / api / discovery / v1 / apis, I get

{"error": {"message": "BackendService.getApiConfigs Error"}}

instead of "Not Found." Tapping Explorer in https://developers.google.com/apis-explorer/?base=http://localhost:8080/_ah/api#p/ will now show a 500 error instead of 404 in the JavaScript console.

I am trying to solve this problem by doing a lot of Google searches and trying a lot, but I just can't go on. I would really appreciate any help I can get from this community of professionals.

Thanks.

+4
source share
3 answers

See the documentation here: https://developers.google.com/appengine/docs/python/endpoints/api_server

You need to do the following:

Change your app.yaml to:

 handlers: - url: /favicon\.ico static_files: favicon.ico upload: favicon\.ico - url: /_ah/spi/.* script: services.application - url: .* script: main.app libraries: - name: webapp2 version: "2.5.2" 

Note URL should be /_ah/spi/.* not /_ah/api/.* . Change it, then you can access your api in /_ah/api/explorer .

+8
source
 - url: .* script: main.app # Endpoints handler - url: /_ah/api/.* script: services.application 

Try changing the order of these handlers. As a general rule, it’s good practice to always put the most common URL tags at the end of the list so that they don’t catch what was intended to go to a more specific handler.

+2
source

Go to app.yaml

 # Endpoints handler - url: /_ah/spi/.* script: services.application libraries: - name: webapp2 version: latest - name: pycrypto version: latest - name: endpoints version: 1.0 
+1
source

All Articles