classEchoRequest(messages.Message):message=messages.StringField(1)classEchoResponse(messages.Message):"""A proto Message that contains a simple string field."""message=messages.StringField(1)ECHO_RESOURCE=endpoints.ResourceContainer(EchoRequest,n=messages.IntegerField(2,default=1))
GET リクエストのように、リクエスト本文に引数がない場合は、リクエストの Message クラスを省略し、値 message_types.VoidMessage をそのまま使用できます。
@endpoints.method(# This method takes a ResourceContainer defined above.ECHO_RESOURCE,# This method returns an Echo message.EchoResponse,path="echo",http_method="POST",name="echo",)defecho(self,request):
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-25 UTC。"],[[["An API is an RPC service with remote methods accessible to external clients, requiring a service class that subclasses `remote.Service`."],["Each API method needs `Message` classes defined for both incoming requests and outgoing responses to properly map data, though these `Message` classes are not part of the exposed API."],["If requests have path or query string arguments, a `ResourceContainer` class should be used instead of a simple `Message` class for data mapping."],["To create an API, you must decorate a subclass of `remote.Service` with `@endpoints.api`, define `Message` or `ResourceContainer` classes for requests and responses, and decorate the method with `@endpoints.method`."],["The API's name and version, specified in the `@endpoints.api` decorator, are incorporated into the API's URL path, allowing for version management."]]],[]]