Tadzys
Tadzys

Reputation: 1092

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!

Upvotes: 6

Views: 2336

Answers (1)

Tadzys
Tadzys

Reputation: 1092

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.

Upvotes: 7

Related Questions