Text-Processing

FREEMIUM
By Jacob | Updated 5 days ago | Text Analysis
Popularity

9.6 / 10

Latency

318ms

Service Level

100%

Health Check

N/A

Back to All Discussions

node js unirest example didn't work for me

Rapid account: Rtanaka
rtanaka
10 years ago

the site shows this code:

var Request = unirest.post(“https://japerk-text-processing.p.mashape.com/sentiment/”)
.headers({
“X-Mashape-Authorization”: “k9PR69i7skxNIMu1ULGbHZ3b3d4QlhB7”
})
.send({
“text”: “great movie”,
“language”: “english”
})
.end(function (response) {
console.log(response);
});

i had to change the send portion to

.send(‘text=great movie’)

to get it to work.

Rapid account: Nijikokun
nijikokun Commented 10 years ago

Yes, japerk only accepts application/form-url-encoded where unirest-nodejs by default sends objects as application/json I’m trying to think of a method that doesn’t break hundreds of other apis and existing implementations using unirest.

Rapid account: Japerk
japerk Commented 10 years ago

Thanks

Rapid account: Nijikokun
nijikokun Commented 10 years ago

I’ve updated unirest-nodejs to support sending FORM unless stated otherwise through usage of .type (Still unsure if this was the best action, as I cannot be sure that ALL apis support solely FORM or solely JSON or a mixture of both, changing unirest is easier than risking breaking code for tons of apis.

Rapid account: Japerk
japerk Commented 10 years ago

Thanks, I’ve alerted Mashape support.

Rapid account: Japerk
japerk Commented 10 years ago

Thanks, I’ve alerted Mashape support.

Join in the discussion - add comment below:

Login / Signup to post new comments