Index a new document
curl --request POST \
--url https://{region}.affinda.com/v3/index/{name}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document": "EhglqBoT"
}
'import requests
url = "https://{region}.affinda.com/v3/index/{name}/documents"
payload = { "document": "EhglqBoT" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({document: 'EhglqBoT'})
};
fetch('https://{region}.affinda.com/v3/index/{name}/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"document": "EhglqBoT"
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}Search & Match
Index a new document
Create an indexed document for the search tool
POST
/
v3
/
index
/
{name}
/
documents
Index a new document
curl --request POST \
--url https://{region}.affinda.com/v3/index/{name}/documents \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document": "EhglqBoT"
}
'import requests
url = "https://{region}.affinda.com/v3/index/{name}/documents"
payload = { "document": "EhglqBoT" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({document: 'EhglqBoT'})
};
fetch('https://{region}.affinda.com/v3/index/{name}/documents', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"document": "EhglqBoT"
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}{
"type": "validation_error",
"errors": [
{
"attr": "non_field_errors",
"code": "unique",
"detail": "This index name has already been used"
}
]
}Authorizations
Basic authentication using an API key, e.g. {Authorization: Bearer aff_0bb4fbdf97b7e4111ff6c0015471094155f91}.
You can find your API key within the Settings page of the Affinda web app. You can obtain an API key by signing up for a free trial.
Path Parameters
Index name Unique index name
Example:
"my-index"
Body
application/json
Document to index
Example:
"EhglqBoT"
Response
Returns the created indexed document
Unique identifier for the document.
Example:
"EhglqBoT"
Was this page helpful?
⌘I