https://recommender-api.lateral.io/
Every request must be authenticated with your subscription key. This must be as a URL parameter like so:
https://recommender-api.lateral.io/recommend/?subscription-key={YOUR_KEY_HERE}
All requests will return a JSON object with the header:
Content-Type: application/json
When a request to a path not in the API is made, you will get the following error message:
{
"statusCode": 404,
"message": "Resource not found"
}
Add a document to your documents collection. Optionally, allows you to store some JSON meta data which is returned when retreiving a document with /fetch
.
Name | Example | Description |
---|---|---|
document_id (string, required)
|
A unique identifier for the document | |
text (string, required)
|
The contents of the document | |
meta (string, optional)
|
A JSON encoded string |
200
{
"text": "lorem ipsum dolor [...]",
"created_at": "2014-11-19 23:15:44.545462",
"meta": "{\\"date\\": \\"2014-11-18\\", \\"type\\": \\"news\\"}",
"document_id": "my_doc_id"
}
406
Returned if the contents of the text
parameter does not have enough meaningful words in it.
<html>
<title>406: less than 25 words recognized</title>
<body>406: less than 25 words recognized</body>
</html>
409
Returned if the document_id
has already been used.
<html>
<title>409: id already exists! document_id doc_id</title>
<body>409: id already exists! document_id doc_id</body>
</html>
Delete a document from your documents collection.
Name | Example | Description |
---|---|---|
document_id (string, required)
|
The identifier for the document |
200
The record that was just deleted, meta data included.
{
"text": "lorem ipsum dolor [...]",
"created_at": "2014-11-19 23:15:44.545462",
"meta": "{\\"date\\": \\"2014-11-18\\", \\"type\\": \\"news\\"}",
"document_id": "my_doc_id"
}
404
Returned if the document to be deleted was not found.
<html>
<title>404: Not Found</title>
<body>404: Not Found</body>
</html>
Deletes all documents in your documents collection. Use with caution!
200
Returned after all documents have been deleted.
Get a single document.
Name | Example | Description |
---|---|---|
document_id (string, required)
|
The identifier for the document |
200
{
"text": "lorem ipsum dolor [...]",
"created_at": "2014-11-19 23:15:44.545462",
"meta": "{\\"date\\": \\"2014-11-18\\", \\"type\\": \\"news\\"}",
"document_id": "my_doc_id"
}
404
Returned if the document with the specified document_id
was not found.
<html>
<title>404: Not Found</title>
<body>404: Not Found</body>
</html>
Returns a list of all document ids
200
[
"doc_id_1",
"doc_id_3",
"doc_id_5"
]
Returns a list of documents that are similar to the document with the given document_id
.
Name | Example | Description |
---|---|---|
document_id (string, required)
|
The identifier for the document to get recommendations for | |
results (integer, optional)
|
How many results to return - Default = 20, Max. = 200 | |
select_from (optional, string) ... A JSON-encoded list of `document_id`s (strings, required)
|
200
The recommendations, an array of objects containing a distance
and a document_id
. These are sorted by the distance to the specified document.
[
{
"distance": 0.000248,
"document_id": "doc_id_2"
},
{
"distance": 0.000419,
"document_id": "doc_id_1"
}
]
404
Returned if the document with the specified document_id
was not found.
<html>
<title>404: Not Found</title>
<body>404: Not Found</body>
</html>
Returns a list of documents that are similar to the given text
.
Name | Example | Description |
---|---|---|
text (string, required)
|
The text to get recommendations for | |
results (integer, optional)
|
How many results to return - Default = 20, Max. = 200 | |
select_from (optional, string) ... A JSON-encoded list of `document_id`'s (strings, required)
|
200
The recommendations, an array of objects containing a distance
and a document_id
. These are sorted by the distance to the specified document.
[
{
"distance": 0.000248,
"document_id": "doc_id_2"
},
{
"distance": 0.000419,
"document_id": "doc_id_1"
}
]
406
Returned if the contents of the text
parameter does not have enough meaningful words in it.
<html>
<title>406: less than 25 words recognized</title>
<body>406: less than 25 words recognized</body>
</html>
Update the meta
field of the record with the given document_id
.
Name | Example | Description |
---|---|---|
document_id (string, required)
|
A unique identifier for the document | |
meta (string, required)
|
A JSON encoded string |
200
{
"text": "lorem ipsum dolor [...]",
"created_at": "2014-11-19 23:15:44.545462",
"meta": "{\\"date\\": \\"2014-11-18\\", \\"type\\": \\"news\\"}",
"document_id": "my_doc_id"
}
404
Returned if the document to be updated was not found.
<html>
<title>404: Not Found</title>
<body>404: Not Found</body>
</html>
Update the meta
field of the record with the given document_id
.
Name | Example | Description |
---|---|---|
document_id (string, required)
|
A unique identifier for the document | |
text (string, required)
|
The contents of the document |
200
{
"text": "lorem ipsum dolor [...]",
"created_at": "2014-11-19 23:15:44.545462",
"meta": "{\\"date\\": \\"2014-11-18\\", \\"type\\": \\"news\\"}",
"document_id": "my_doc_id"
}
404
Returned if the document to be updated was not found.
<html>
<title>404: Not Found</title>
<body>404: Not Found</body>
</html>
406
Returned if the contents of the text
parameter does not have enough meaningful words in it.
<html>
<title>406: less than 25 words recognized</title>
<body>406: less than 25 words recognized</body>
</html>
Simply enter your details below and we'll email your API key to you!
We will process your data as described in our Terms of Use, Privacy Policy and Data Processing Agreement