You're viewing **Apigee Edge** documentation.  
[Go to the
**Apigee X** documentation](http://cloud.google.com/apigee/docs). info


> [!NOTE]
> **Note:** Apigee Extensions are available in the Edge UI to Google Cloud Apigee customers with an Enterprise [support](https://cloud.google.com/apigee/pricing) plan.

> [!NOTE]
> **Note:** Extensions marked as deprecated will no longer be available for selection by users. However, the currently deployed version(s) will remain unaffected.

> [!CAUTION]
> **Caution:** This version of the extension is no longer supported and has been deprecated.

<br />

> Version 1.4.1

Provides access to the [Google Cloud Natural Language API](https://cloud.google.com/natural-language/docs/).

Use this extension to classify content by applying categories, as well as to analyze content sentiment on a positive to negative scale.

> [!NOTE]
> **Note:** To use the Natural Language Extension, you'll need a GCP Service Account JSON key file with Natural Language APIs enabled.

This content provides reference for configuring and using this extension. For steps to configure an extension using the Apigee console, see [Adding and configuring an extension](https://docs.apigee.com/api-platform/extensions/configuring-an-extension).

## Actions


> [!NOTE]
> **Note:** See the [ExtensionCallout policy](https://docs.apigee.com/api-platform/reference/policies/extension-callout-policy) for more information on setting [`<Action>`](https://docs.apigee.com/api-platform/reference/policies/extension-callout-policy#action_element), [`<Input>`](https://docs.apigee.com/api-platform/reference/policies/extension-callout-policy#input_element), and [`<Output>`](https://docs.apigee.com/api-platform/reference/policies/extension-callout-policy#output_element).

<br />

### classifyContent

Analyzes a portion of text and returns a list of content categories that apply to the text.

For more on this feature in the Natural Language API, see [Classifying Content](https://cloud.google.com/natural-language/docs/classifying-text#language-classify-content-nodejs) and [Content Categories](https://cloud.google.com/natural-language/docs/categories).

#### Request parameters

    <Input><![CDATA[{
      "data" : "content-to-analyze"
    }]]></Input>

| Parameter | Description | Type | Default | Required |
|---|---|---|---|---|
| data | The content to analyze. | String | None. | Yes. |

#### Response

A [Categories](https://cloud.google.com/natural-language/docs/categories) array in which each item contains a category for classifying the content and a confidence score.

### sentenceSentiment

Analyzes the given text and identifies the prevailing emotional opinion within it, especially to determine a writer's attitude as positive, negative, or neutral.

For more on this feature in the Natural Language API, see [Analyzing Sentiment](https://cloud.google.com/natural-language/docs/analyzing-sentiment) and [Natural Language API Basics](https://cloud.google.com/natural-language/docs/basics#interpreting_sentiment_analysis_values).

#### Request parameters

    <Input><![CDATA[{
      "data" : "content-to-analyze"
    }]]></Input>

| Parameter | Description | Type | Default | Required |
|---|---|---|---|---|
| data | The content to analyze. | String | None. | Yes. |

#### Response

An object containing sentiment scores for the document overall and each of its sentences (in an array). For both the document and its sentences, the following properties are included:

- A Content property with the content analyzed.
- A Score property indicating the content's sentiment on a scale between 1 and -1, from positive (positive number) to negative (negative number).
- A Magnitude property indicating the overall strength of emotion (both positive and negative) within the content, between 0.0 and +inf.

### entitySentiment

Analyzes the specified text to determine the sentiment (positive or negative) expressed about each [entity](https://cloud.google.com/natural-language/docs/reference/rest/v1/Entity) within the text. Entity sentiment is represented by numerical score and magnitude values and is determined for each mention of an entity. Those scores are then aggregated into an overall sentiment score and magnitude for an entity.

For more about entity analysis in the Google Cloud Natural Language API, see [Analyzing Entity Sentiment](https://cloud.google.com/natural-language/docs/analyzing-entity-sentiment) and [Interpreting sentiment analysis values](https://cloud.google.com/natural-language/docs/basics#interpreting_sentiment_analysis_values).

#### Request parameters

    <Input><![CDATA[{
      "data" : "content-to-analyze"
    }]]></Input>

| Parameter | Description | Type | Default | Required |
|---|---|---|---|---|
| data | The content to analyze. | String | None. | Yes. |

#### Response

An array of objects containing sentiment scores for entities in the text. For both the document and its sentences, the following properties are included:

- A Name property with .
- A [Type](https://cloud.google.com/natural-language/docs/reference/rest/v1/Entity#Type) property describing the entity's type.
- A Score property indicating the entity's sentiment on a scale between 1 and -1, from positive (positive number) to negative (negative number).
- A Magnitude property indicating the strength of emotion (both positive and negative) for the entity, between 0.0 and +inf.

## Configuration Reference

Use the following when you're configuring and deploying this extension for use in API proxies.

> [!NOTE]
> **Note:** The ability to configure and deploy extensions is available only to organization administrators.

### Common extension properties

The following properties are present for every extension.

| Property | Description | Default | Required |
|---|---|---|---|
| `name` | Name you're giving this configuration of the extension. | None | Yes |
| `packageName` | Name of the extension package as given by Apigee Edge. | None | Yes |
| `version` | Version number for the extension package from which you're configuring an extension. | None | Yes |
| `configuration` | Configuration value specific to the extension you're adding. See [Properties for this extension package](https://docs.apigee.com/api-platform/reference/extensions/google-cloud-natural-language/google-cloud-natural-language-extension-141#properties_for_this_extension_package) | None | Yes |

### Properties for this extension package

Specify values for the following configuration properties specific to this extension.

| Property | Description | Default | Required |
|---|---|---|---|
| credentials | When entered in the Apigee Edge console, this is the contents of your [service account key file](https://cloud.google.com/iam/docs/creating-managing-service-account-keys). When sent via the management API, it is a base64-encoded value generated from the service account key file. | None. | Yes. |