I am starting to use Google Cloud Endpoints and I am running in a problem when specifying multiple services classes. Any idea how to get this working?
ApiCon
The correct way is to create an api
object and use the collection
api_root = endpoints.api(name='myservice', version='v1', description='MyService API')
@api_root.collection(resource_name='first')
class FirstService(remote.Service):
...
@api_root.collection(resource_name='second')
class SecondService(remote.Service):
...
where resource name would be inserted in front of method names so that you could use
@endpoints.method(name='method', ...)
def MyMethod(self, request):
...
instead of
@endpoints.method(name='first.method', ...)
def MyMethod(self, request):
...
The api_root
object is equivalent to a remote.Service
class decorated with endpoints.api
, so you can simply include it in the endpoints.api_server
list. For example:
application = endpoints.api_server([api_root, ...])