This page shows how to get started with the Cloud Client Libraries for the Datastore API. Read more about the client libraries for Cloud APIs, including the older Google API Client Libraries, in Client Libraries Explained.
Install the client library
C#
For more information, see Setting Up a C# Development Environment.
Install-Package Google.Cloud.Datastore.V1
Go
For more information, see Setting Up a Go Development Environment.
go get cloud.google.com/go/datastore
Java
For more information, see Setting Up a Java Development Environment.
If you are using Maven, add
the following to your pom.xml
file. For more information about
BOMs, see The Google Cloud Platform Libraries BOM.
If you are using Gradle, add the following to your dependencies:
If you are using sbt, add the following to your dependencies:
If you're using Visual Studio Code, IntelliJ, or Eclipse, you can add client libraries to your project using the following IDE plugins:
The plugins provide additional functionality, such as key management for service accounts. Refer to each plugin's documentation for details.
Node.js
For more information, see Setting Up a Node.js Development Environment.
npm install --save @google-cloud/datastore
PHP
For more information, see Using PHP on Google Cloud.
composer require google/cloud-datastore
Python
For more information, see Setting Up a Python Development Environment.
pip install --upgrade google-cloud-datastore
Ruby
For more information, see Setting Up a Ruby Development Environment.
gem install google-cloud-datastore
Set up authentication
When you use client libraries, you use Application Default Credentials (ADC) to authenticate. For information about setting up ADC, see Provide credentials for Application Default Credentials. For information about using ADC with client libraries, see Authenticate using client libraries.
Use the client library
The following example shows how to use the client library.
C#
Before trying this sample, follow the C# setup instructions in Setting up a C# development environment. For more information, see the Datastore mode C# API reference documentation.
To authenticate to Datastore mode, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
To use this sample, prepare your machine for Go development, and complete the Datastore mode quickstart. For more information, see the Datastore mode Go API reference documentation.
To authenticate to Datastore mode, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
Before trying this sample, follow the Java setup instructions in Setting up a Java development environment. For more information, see the Datastore mode Java API reference documentation.
To authenticate to Datastore mode, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
Before trying this sample, follow the Node.js setup instructions in Setting up a Node.js development environment. For more information, see the Datastore mode Node.js API reference documentation.
To authenticate to Datastore mode, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
PHP
To use this sample, prepare your machine for PHP development, and complete the Datastore mode quickstart. For more information, see the Datastore mode PHP API reference documentation.
To authenticate to Datastore mode, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
Before trying this sample, follow the Python setup instructions in Setting up a Python development environment. For more information, see the Datastore mode Python API reference documentation.
To authenticate to Datastore mode, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
Before trying this sample, follow the Ruby setup instructions in Setting up a Ruby development environment. For more information, see the Datastore mode Ruby API reference documentation.
To authenticate to Datastore mode, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Additional resources
C#
Go
Java
Node.js
PHP
Python
Ruby
Dependency on App Engine application
Google App Engine Standard Environment Client Libraries
Integrate Firestore in Datastore mode with your App Engine Standard Environment applications by using the App Engine client libraries.
Language | Library |
---|---|
Go | Google App Engine SDK for Go |
Java | Google App Engine SDK for Java |
Python 3 | Google Cloud Datastore client library or the Google Cloud NDB Client Library. |
Python 2 | Google Cloud NDB Client Library |
Third-party Datastore API client libraries
In addition to the Google-supported client libraries listed in the tables above, a set of third-party libraries are available.
Language | Library |
---|---|
Java | Objectify |
PHP | Datastore Library for PHP |