RapidAPI logo

Text-Processing

FREEMIUM
By japerk
Updated 4 months ago
Other
9.3/10
Popularity Score
563ms
Latency
73%
Success Rate
rtanaka5 years ago
node js unirest example didn't work for methe 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.
nijikokun5 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.
japerk5 years ago
Thanks
nijikokun5 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.
japerk5 years ago
Thanks, I've alerted Mashape support.
japerk5 years ago
Thanks, I've alerted Mashape support.
Hi Developer, feel free to post your answer:
Log inSign up

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://japerk-text-processing.p.rapidapi.com/phrases/")
.header("X-RapidAPI-Host", "japerk-text-processing.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.send("language=spanish")
.send("text=California is nice")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication