Re: Datastore query

70 views
Skip to first unread message
Message has been deleted

Alexey

unread,
Jan 2, 2017, 2:12:18 PM1/2/17
to Google App Engine
Welcome, Yair,

You wrote your own servlet that is able to write data to Datastore?  Is there some snippet of code you can post here to make it clear where you're stuck?  Are you using Datastore API from App Engine SDK directly or are you using some framework?

On Monday, January 2, 2017 at 9:18:09 AM UTC-5, Yair Ko wrote:
Hello everybody, my first post here :)

I deployed a servlet module and I'm able to write Entities (successfully). No problem here.
At some point the user (android app) wants to read/query the Datastore for Entities/data.

Question is how do I do it ? Is it done using the already existing servlet ?

Appreciate



Jordan (Cloud Platform Support)

unread,
Jan 2, 2017, 2:54:44 PM1/2/17
to Google App Engine
To allow external clients to perform a read operation on your Google Cloud project's Datastore, you will need to expose an App Engine Endpoint. Simply create an App Engine method that performs the Datastore query operation you want; then turn that method into an Endpoint API as seen in our Quick Start tutorial. Your Android client will then be able to call your new Endpoint API URL to perform the Datastore query.

Yair Ko

unread,
Jan 3, 2017, 12:44:02 AM1/3/17
to Google App Engine
Thank you Jordan for the fast response.

What you are offering is regardless of the servlet module I deployed to app engine ( which writes to datastore ) ?
There is no other way than Endpoints, for datastore query ?

Jordan (Cloud Platform Support)

unread,
Jan 3, 2017, 10:28:17 AM1/3/17
to Google App Engine
Hey Yair,

The less secure way to allow your Android client to query your Datastore would be to directly allow the client access using the Datastore Client Library. By using the Client Library directly in the client, you are trusting that the client will never be tampered with and that they will never perform any action that could harm your Datastore data.

Therefore as previously recommended, it is more secure to limit the requests your Android client is able to perform by creating your own API with set Datastore queries that your App Engine instances make via Endpoints. By adding this layer, your Android clients simply make requests to your custom APIs running from App Engine instead of having direct access to the entire Datastore Client Library. 

For more information on how to make requests to your custom Endpoints from Android clients, you can view our Calling Endpoints tutorial
 
 
Reply all
Reply to author
Forward
0 new messages