'Cannot connect to Meaning Cloud API: key missing
I have tried connecting to the API but for some reason it says I am missing the key. I am including the key and when I log it in the console, I see the correct value. Even I test the value of the API key that is logged, in the Meaning Cloud test tool, and it works correctly. Since at the moment is only a test, I have added directly a URL of an article that I want to check with the API.
Test API: https://learn.meaningcloud.com/developer/sentiment-analysis/2.1/console
I am using axios but I also tried with node-fetch and got the same result.
Here is the full code of the project in Github: https://github.com/schilate68/Natural_Language_Processing/blob/master/src/server/index.js
app.post('/test', function (req, res) {
console.log("In POST test API");
console.log(process.env.API_KEY);
axios
.post('https://api.meaningcloud.com/sentiment-2.1', {
key: process.env.API_KEY,
url: 'https://blog.logrocket.com/complete-guide-flutter-architecture/',
lang: "en"
})
.then(res => ({
status: res.status,
body: res.data
}))
.then(({ status, body }) => console.log(status, body))
.catch(error => {
console.error(error)
})
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
