Perspective API

Hi,

I’m trying yo use the Google Perspective API in a Knime flow.

Here there is an example of a simple request

$ curl -H “Content-Type: application/json” --data
‘{comment: {text: “what kind of idiot name is foo?”},
languages: [“en”],
requestedAttributes: {TOXICITY:{}} }’
https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze?key=YOUR_KEY_HERE

I tried to use the POST Request Node with the following parameters:

and url

https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze?key=YOUR_KEY_HERE

I get an error

ERROR POST Request 3:126:140 Execute failed: Wrong status: 400 Bad Request

any idea why it is not working?

Thanks!

Hi,
just to make sure: You used a proper API key in the URL and not the placeholder “YOUR_KEY_HERE” when you made the request, correct? Otherwise you will first need to acquire an API key to authenticate your requests with.
Kind regards,
Alexander

Yes! I just didn’t want to write my key here in a public forum.

I get a key from the Google developers site.

Thanks!

Guillem

Hi,
OK, perfect. Did you get any response back from the API? Any error messages in the body column?
Kind regards,
Alexander

It works!

It checked the body column and the error was the API key, because it was created but not activated.

So, it was my fault.

Thanks for your help!

1 Like