简体   繁体   中英

tone analyzer api cannot be connected

I was trying to connect to Tone Analyzer through its API. I have created credentials on Bluemix as followes:

ta_url = "https://gateway.watsonplatform.net/tone-analyzer-experimental/api/v2/profile"
username =  "xxxxxxxxxxxxxxxxxxxxxxxxx"
password = "yyyyyyyyyy"

I am able to connect to Personality Insight using the same method (the credentials are created separately).

Your kind help will be appreciated!

Best regards, Ken

Tone Analyzer and Personality Insights are two different services.
Looking at the url you are trying to use:

https://gateway.watsonplatform.net/tone-analyzer-experimental/api/v2/profile

I would guess that you are trying to use the /tone call which analyzes the "tone" of a piece of text.

The correct url should be:

https://gateway.watsonplatform.net/tone-analyzer-beta/api/v3/tone

Example Curl request

curl -X POST \
 -u USERNAME:PASSWORD \
 -H "Content-Type: application/json" \
 -d 'This is an important email. You should be working on X and have it ready by Friday' \
 "https://gateway.watsonplatform.net/tone-analyzer-experimental/api/v3/tone?version=2016-02-11"

Make sure you replace USERNAME and PASSWORD with your service credentials.


See the Tone Analyzer documentation to read more about the service.
See API Explorer to learn more about the API.

Update: Tone Analyzer is now Beta; URLs have been corrected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM