Sign Up

Log In

Text-Processing

FREEMIUM
By japerk
Updated 2 months ago
Other
9.5/10
Popularity Score
292ms
Latency
34%
Success Rate
ajtrichards5 years ago
Text: This field is requiredI'm trying to send some text to the API for sentiment analysis but I keep getting the the error = Text: This field is required. I'm not using the Unirest library as I'm already using another one: https://github.com/rmccue/Requests The code i'm using is: ``` $headers = array('Accept' => 'application/json', 'Content-Type' => 'application/json', 'X-Mashape-Authorization' => 'KEYNAME'); Requests::register_autoloader(); $data = array("text" => "Possibly sending a statement each month on what movie they have seen and how much they have saved.", "language" => ""); $request = Requests::post('https://japerk-text-processing.p.mashape.com/sentiment/', $headers, $data); ``` The $data is the CURL PostFields data so the text field is present. Is there something in the code above wrong? I've never had any other problems with this library and I don't want to change.
jroven3 months ago
Wow! Took some searching for this answer but it worked for me. Thanks.
japerk5 years ago
Try doing a post without the Content-Type header
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", "undefined")
.header("X-RapidAPI-Key", "undefined")
.header("Content-Type", "application/x-www-form-urlencoded")
.send("language=undefined")
.send("text=<required>")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication

Sign up for free

to test this endpoint

Join the world’s largest API marketplace with over half a million developers and thousands of APIs.
DiscoverAPIs
Testfrom the browser
Connectusing code snippets
Managefrom one dashboard