Detect the sentiment

Overview

This API detects sentiment ('Very Negative', 'Negative', 'Neutral', 'Positive', or 'Very Positive') and sentiment score (in 0 to 1 range) in text.

For this API to execute succesfully

  • Text must not exceed 5,000 bytes of UTF-8 encoded characters in length
  • Language attribute value must be a supported language code.

Scope

Client app must have 'app.core.microservicesmgr.sentiment.read' scope assigned.

SecurityoAuthClient
Request
Request Body schema: application/json
text
required
string [ 1 .. 5000 ] characters

Text to be analyzed. Must not exceed 5,000 bytes of UTF-8 encoded characters in length

language
string
Default: "en"

Language code

Enum: "en" "es" "fr" "de" "it" "pt" "ar" "hi" "ja" "ko" "zh" "zh-TW"
Responses
200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

500

Internal server error

post/sentiments
Request samples
application/json
{
  • "text": "The weather is nice",
  • "language": "en"
}
Response samples
application/json
{
  • "sentiment": "Very Positive",
  • "score": 0.997
}