Sha256: 5206ad701b899da2838ef3e864e9fe2652038b8395ae3c4987991a34637293ce

Contents?: true

Size: 1.01 KB

Versions: 41

Compression:

Stored size: 1.01 KB

Contents

# API Keys

When calling APIs that do not access private user data, you can use simple API keys. These keys are used to authenticate your application for accounting purposes. The Google Developers Console documentation also describes [API keys](https://developers.google.com/console/help/using-keys).

> Note: If you do need to access private user data, you must use OAuth 2.0. See [Using OAuth 2.0 for Installed Applications](oauth-installed.md), [Using OAuth 2.0 for Server to Server Applications](oauth-server.md), and [Using OAuth 2.0 for Web Server Applications](oauth-web.md) for more information.

## Using API Keys

To use API keys, set the `key` attribute on service objects. For example:

```ruby
require 'google/apis/translate_v2'

translate = Google::Apis::TranslateV2::TranslateService.new
translate.key = 'YOUR_API_KEY_HERE'
result = translate.list_translations('Hello world!', 'es', source: 'en')
puts result.translations.first.translated_text
```

All calls made using that service object will include your API key.

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
google-api-client-0.52.0 docs/api-keys.md
google-api-client-0.51.0 docs/api-keys.md
google-api-client-0.50.0 docs/api-keys.md
google-api-client-0.49.0 docs/api-keys.md
google-api-client-0.48.0 docs/api-keys.md
google-api-client-0.47.0 docs/api-keys.md
google-api-client-0.46.2 docs/api-keys.md
google-api-client-0.46.1 docs/api-keys.md
google-api-client-0.46.0 docs/api-keys.md
google-api-client-0.45.1 docs/api-keys.md
google-api-client-0.45.0 docs/api-keys.md
google-api-client-0.44.2 docs/api-keys.md
google-api-client-0.44.1 docs/api-keys.md
google-api-client-0.44.0 docs/api-keys.md
google-api-client-0.43.0 docs/api-keys.md
google-api-client-0.42.2 docs/api-keys.md
google-api-client-0.42.1 docs/api-keys.md
google-api-client-0.42.0 docs/api-keys.md
google-api-client-0.41.2 docs/api-keys.md
google-api-client-0.41.1 docs/api-keys.md