Cloud Endpoints Frameworks v1 has been deprecated and will be shut down on August 2, 2018. We recommend that you use the latest version of this feature, which is renamed to Cloud Endpoints Frameworks for App Engine. This new version supports App Engine standard environment, provides lower latency, and has better integration with App Engine. For more details, see Migrating to 2.0.
You must define an API server that uses the API or APIs you have created. To define an API server:
Create a Python module, for example
main.py, and create an
endpoints.api_serverobject at the top-level:
api = endpoints.api_server([GreetingApi, AuthedGreetingApi])
Note that you provide a list of
remote.Serviceobjects to the API server. If you have an API that is implemented in several classes, then your
Serviceobject is a collection of classes as described in Creating an API Implemented with Multiple Classes.
Notice that we describe using a separate module for the API server: this is not a requirement! If you are defining multiple APIs (
remote.Servicesubclasses) that are defined in multiple files, it might be preferable to have a separate module for your API Server in order to import all these class files. However, alternatively, you could just add the required
endpoints.api_servercode shown above to the module where you define your API. If you are defining only a single API, it may be preferable to define the API server in the same file where you define your API because it doesn't need to import any other classes.
app.yamlfile, map the API server you just created to the endpoints location as follows:
handlers: # The endpoints handler must be mapped to /_ah/spi. # Apps send requests to /_ah/api, but the endpoints service handles mapping # those requests to /_ah/spi. - url: /_ah/spi/.* script: main.api
mainis the Python module you used for your API server module. Notice that the endpoints path must be
/_ah/spirelative to the application. Although applications send their requests to
/_ah/api, the Endpoints backend actually handles these requests at the path
Add Endpoints to the Libraries section of
app.yaml, since the Endpoints library is not included by default:
libraries: - name: pycrypto version: 2.6 - name: endpoints version: 1.0
Note that you should specify the desired Endpoints library version. Currently, the only version available is the GA version, 1.0.