Search code examples
google-app-enginegoogle-cloud-endpoints

Sending and storing text over endpoints


This is a very simple question: what method would you advise to send text, not formatted, simple text with possible carriage returns, over Endpoints (or google's Proto-RPC library), and store it?

Obviously, the best way to store it is to user the ndb.TextProperty, but how "flexible" is the messages.StringField RPC field? Should i rather use the messages.ByteField ?

If you know anything about length limitations, encoding and such, go ahead and share your knowledge.


Solution

  • You should serialize it to base64 and BytesField will do this by default.

    This both reduces the need to deal with exotic characters (e.g. carriage return) and reduces the size of the payload.