Fetches one or more specific documents by their IDs and datatype directly from the search index.
Requires authentication.
Request
POST /documents/byId
Headers
| Header | Value |
|---|---|
Authorization | Bearer <token> |
Content-Type | application/json |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
datatype | string | Yes | The document type. Common values: product, category, manufacturer. |
ids | array | Yes | Array of document IDs to fetch. |
constraints | object | Yes | Query constraints. |
constraints.query.language | string | Yes | Language identifier for the index to search in. |
Example Request
POST /documents/byId
Authorization: Bearer <token>
Content-Type: application/json
{
"datatype": "category",
"ids": ["cat-123", "cat-456"],
"constraints": {
"query.language": "de"
}
}Response
Returns a JSON array of matching document objects. Documents that are not found are omitted from the response.
Response Body
Each object in the array contains:
| Field | Type | Description |
|---|---|---|
id | string | Document identifier. |
es_id | string | Elasticsearch document ID. |
title | string | Display title of the document. |
url | string | URL of the document. |
type | string | Document type. |
manufacturer_title | string | Manufacturer name (for products). |
category_title | string | Category name (for products). |
ean | string | EAN/barcode (for products). |
Example Response
[
{
"id": "cat-123",
"es_id": "category_cat-123",
"title": "Men's Shoes",
"url": "/men/shoes",
"type": "category",
"manufacturer_title": null,
"category_title": null,
"ean": null
}
]
