TextAnalysis

FREEMIUM
By TextMiner | Updated 7일 전 | Tools
Popularity

9 / 10

Latency

281ms

Service Level

100%

Health Check

N/A

Back to All Discussions

Demo not working

Rapid account: Yzini
yzini
9년 전

I use the demo code for node.js and get the following response:
400 { ‘content-type’: ‘text/html’,
date: ‘Wed, 10 Dec 2014 13:46:37 GMT’,
server: ‘Mashape/5.0.5’,
‘x-ratelimit-requests-limit’: ‘1000’,
‘x-ratelimit-requests-remaining’: ‘996’,
‘content-length’: ‘192’,
connection: ‘keep-alive’ } ‘<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 3.2 Final//EN”>\n<title>400 Bad Request</title>\n<h1>Bad Request</h1>\n<p>The browser (or proxy) sent a request that this server could not understand.</p>\n’

Rapid account: Textanalysis
textanalysis Commented 9년 전

close it now, thanks

Rapid account: Textanalysis
textanalysis Commented 9년 전

After reading the Unirest Node Js document and test the node code again, I have found the bug. You should change:

.header(“Content-Type”, “application/x-www-form-urlencoded”)
==>
.header(“Accept”, “application/x-www-form-urlencoded”)

The whole example code like this:

var unirest = require(‘unirest’);

unirest.post(“https://textanalysis.p.mashape.com/mbsp-word-lemmatize”)
.header(“X-Mashape-Key”, “Your mashape api key”)
.header(“Accept”, “application/x-www-form-urlencoded”)
.field(“text”, “this is word lemmatize test”)
.end(function (result) {
console.log(result.status, result.headers, result.body);
});

Rapid account: Textanalysis
textanalysis Commented 9년 전

Sorry, I’m not familar with Node js and test it with the document code, and found the same error like yours. The code generated by Mashape platform, and I can’t find why it’s wrong now. But test it with the curl and python, I get right response. The problem seems caused by the unirest node js library.

Rapid account: Yzini
yzini Commented 9년 전

I copy paste the demo code for node js

Rapid account: Textanalysis
textanalysis Commented 9년 전

can you tell me which api you called? thanks

Join in the discussion - add comment below:

Login / Signup to post new comments