TextAnalysis

FREEMIUM
(Ким) TextMiner | Оновлено il y a 21 jours | Tools
Популярність

9 / 10

Затримки

293ms

Рівень обслуговування

100%

Health Check

N/A

Повернутися до всіх обговорень

Demo not working

Rapid account: Yzini
yzini
il y a 9 ans

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 il y a 9 ans

close it now, thanks

Rapid account: Textanalysis
textanalysis Commented il y a 9 ans

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 il y a 9 ans

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 il y a 9 ans

I copy paste the demo code for node js

Rapid account: Textanalysis
textanalysis Commented il y a 9 ans

can you tell me which api you called? thanks

Приєднуйтесь до обговорення — додайте повідомлення нижче:

Вхід / Реєстрація, щоб публікувати нові повідомлення