Question

i'm new to the cloud endpoint of GAE. I've made a small example, but it does not work, this is the terminal output:

INFO     2014-04-17 16:34:50,293 sdk_update_checker.py:242] Checking for updates to the SDK.
INFO     2014-04-17 16:34:51,227 sdk_update_checker.py:286] This SDK release is newer than the advertised release.
WARNING  2014-04-17 16:34:51,240 api_server.py:374] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO     2014-04-17 16:34:51,244 api_server.py:171] Starting API server at: http://localhost:64102
INFO     2014-04-17 16:34:51,248 dispatcher.py:182] Starting module "default" running at: http://localhost:8080
INFO     2014-04-17 16:34:51,253 admin_server.py:117] Starting admin server at: http://localhost:8000
INFO     2014-04-17 16:34:58,926 module.py:627] default: "GET /_ah/api/static/proxy.html?jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.5SU5w8-2ONg.O%2Fm%3D__features__%2Fam%3DAQ%2Frt%3Dj%2Fd%3D1%2Fz%3Dzcms%2Frs%3DAItRSTMA_WMz6FduGUvb6_l_lrFfWB57ig HTTP/1.1" 200 7327
INFO     2014-04-17 16:34:59,038 module.py:627] default: "POST /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 404 -
INFO     2014-04-17 16:34:59,038 module.py:627] default: "GET /_ah/api/discovery/v1/apis HTTP/1.1" 500 60

as you see there's a 404 and a 500, which i don't know why

this is the code i wrote:

import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remote


package = 'mypackage'

class YourResponseMessageClass(messages.Message):
    message = messages.StringField(1)


@endpoints.api(name='myendpoint', version='v1')
class ExampleAPI(remote.Service):
    @endpoints.method(message_types.VoidMessage,
                  YourResponseMessageClass,
                  name='foo.bar')
    def user_get(self, request):
        return YourResponseMessageClass(message="ciao")



APPLICATION = endpoints.api_server([ExampleAPI])

i've all the file in the same folder (can i move the api in subfolder btw?), and my yaml file looks like this:

application: ls-gae-api
version: 1
runtime: python27
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico


# Endpoints handler
- url: /_ah/api/.*
  script: myfile.APPLICATION

libraries:
- name: webapp2
  version: "2.5.2"
- name: endpoints
  version: 1.0
Was it helpful?

Solution

Correct path for Endpoints handler must be the following:

# Endpoints handler
- url: /_ah/spi/.*
  script: myfile.APPLICATION

Note the spi part (you have api).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top