Document Similarity

FREEMIUM
От TextMiner | Обновлено 16 days ago | Data
Популярность

0 / 10

Задержка

13ms

Уровень обслуживания

0%

Health Check

N/A

Назад ко всем обсуждениям

Bad Request

Rapid account: Lukemunn
lukemunn
7 years ago

Have tested using PHP with Unirest, PHP with CURL and CURL tester with Hurl.it

All receive the same response,

Bad Request
The browser (or proxy) sent a request that this server could not understand.

This is using the stock example code from the Documentation page. Either there is something wrong with this API, or something missing from the documentation.

Rapid account: Textanalysis
textanalysis Commented 7 years ago

close it

Rapid account: Textanalysis
textanalysis Commented 7 years ago

maybe you have used it more than the limit of the api

Rapid account: Lukemunn
lukemunn Commented 7 years ago

I also got 400 Bad Request using your code examples with my API key as well.

Either my API key is getting blocked - in which case a more specific error code would be helpful.

Or there’s something else wrong, perhaps with the Unirest library integration?

Have you got a full example in PHP that works?

Rapid account: Textanalysis
textanalysis Commented 7 years ago

I’m not familar with PHP, so test it on the mashape website, and got the 200 response:

// These code snippets use an open-source library. http://unirest.io/php
$response = Unirest\Request::post(“https://textanalysis-document-similarity-v1.p.mashape.com/document-similarity”,
array(
“X-Mashape-Key” => “…”,
“Content-Type” => “application/x-www-form-urlencoded”,
“Accept” => “application/json”
),
array(
“text1” => “Deep learning is a set of algorithms in machine learning that attempt to model high-level abstractions in data by using model architectures composed of multiple non-linear transformations.”,
“text2” => “Machine learning is a scientific discipline that explores the construction and study of algorithms that can learn from data.”
)
);

Rapid account: Textanalysis
textanalysis Commented 7 years ago

I have test it with curl, and get the 200 ok response:

curl -X POST --include ‘https://textanalysis-document-similarity-v1.p.mashape.com/document-similarity’ \

-H ‘X-Mashape-Key: YourAPIKey’
-H ‘Content-Type: application/x-www-form-urlencoded’
-H ‘Accept: application/json’
-d ‘text1=Deep learning is a set of algorithms in machine learning that attempt to model high-level abstractions in data by using model architectures composed of multiple non-linear transformations.’
-d ‘text2=Machine learning is a scientific discipline that explores the construction and study of algorithms that can learn from data.’

HTTP/1.1 200 OK
Content-Type: application/json
Date: Tue, 21 Feb 2017 02:52:30 GMT
Server: Mashape/5.0.6
Content-Length: 26
Connection: keep-alive

{
“similarity”: 0.7179
}

Rapid account: Lukemunn
lukemunn Commented 7 years ago

<?php

require_once ‘unirest-php/src/Unirest.php’;

// These code snippets use an open-source library. http://unirest.io/php

$response = Unirest\Request::post(“https://textanalysis-document-similarity-v1.p.mashape.com/document-similarity”,
array(
“X-Mashape-Key” => " — ",
“Content-Type” => “application/x-www-form-urlencoded”,
“Accept” => “application/json”
),
array(
“text1” => “Deep learning is a set of algorithms in machine learning that attempt to model high-level abstractions in data by using model architectures composed of multiple non-linear transformations.”,
“text2” => “Machine learning is a scientific discipline that explores the construction and study of algorithms that can learn from data.”
)
);

echo $response;

?>

Rapid account: Textanalysis
textanalysis Commented 7 years ago

can you give me the example you test? or you can test it on the demo first: http://documentsimilarity.com/document-similarity-demo

Присоединяйтесь к обсуждению – добавьте комментарий ниже:

Войдите / Зарегистрируйтесь, чтобы публиковать новые комментарии