What are ResourceContainers and how to use them for Cloud Endpoints?

With Google AppEngine 1.8.5, there is a new warning in the development environment:

WARNING 2013-09-27 10:10:53,035 api_config.py:1768] Method specifies path parameters but you are not using a ResourceContainer. This will fail in future releases; please switch to using ResourceContainer as soon as possible. 

What are ResourceContainers and how to use them?

+6
source share
1 answer

They recently updated documents to explain this change here: Google App Engine Docs

Basically you want to separate the request body and the request / path parameters.

The request body will be the usual messages.Message class, and you define any additional parameters in the ResourceContainer .

 YOUR_RESOURCE_CONTAINER = endpoints.ResourceContainer( MyRequestBodyMessagesClass, parameter1=messages.IntegerField(2, required=True) parameter2=messages.StringField(3)) 

This change should help minimize the number of message classes required, since you can mainly reuse RequestBody-Message for message replies.

Note: if you use endpoints-proto-datastore , a question about this will open.

+9
source

Source: https://habr.com/ru/post/954764/


All Articles