Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inserting entity to google cloud datastore using REST API

Trying to use rest api for google datastore (unfortunately there is no client library for c++). Got stuck on inserting an entity.

Reading documentation, which is unfortunately not very good (at least for REST). It doesn't tell what is the URI, so I am guessing it is the following:

POST https://datastore.googleapis.com/v1/projects/{projectId}:Entity

but unfortunately I get a reply: The requested URL /v1/projects/my_project_id:Entity was not found on this server.

Anyone out there is/was using it? Any help would be appreciated. Thanks!

like image 528
Tadzys Avatar asked Jan 30 '17 09:01

Tadzys


1 Answers

Managed to find the answer. Entity is an object. Correct api call is projects.commit:

POST https://datastore.googleapis.com/v1/projects/{projectId}:commit

And then in the json object I need to pass insert mutation.

Somehow misunderstood the terminology, thought commit is needed after you do actual insert.

Here is the actual documentation link.

like image 62
Tadzys Avatar answered Sep 28 '22 06:09

Tadzys