This page describes two endpoints for retrieving related information for a query.
GET /related-queries— Retrieves related query suggestions for a query.GET /related-content— Retrieves related HTML content for a query.
Both results are based on the related-query and related-content settings registered in advance by the administrator. An empty result is returned when no matching setting exists.
For the common response envelope and error model, see API Overview.
Fetching Related Queries
Request
| HTTP Method | GET |
| Endpoint | /api/v2/related-queries |
By sending a request to Fess such as http://<Server Name>/api/v2/related-queries?q=fess, you can receive a list of related query terms for the specified query in JSON format.
The requested search term is matched case-insensitively against the registered related-query settings. If q is empty or not specified, no error is returned; instead, an empty queries array is returned. The response is always a success envelope.
Request Parameters
Response
On success, the following response is returned in the common envelope format.
{
"response": {
"status": 0,
"queries": [
"fess search",
"fess install"
]
}
}
Each element of response is as follows:
Usage Example
Request example using curl:
curl "http://localhost:8080/api/v2/related-queries?q=fess"
Error Response
Fetching Related Content
Request
| HTTP Method | GET |
| Endpoint | /api/v2/related-content |
By sending a request to Fess such as http://<Server Name>/api/v2/related-content?q=fess, you can receive related HTML content for the specified query in JSON format.
The requested search term is matched against the registered related-content settings. When multiple content items match, they are concatenated with newlines. If q is empty or not specified, no error is returned; instead, an empty string content is returned. The response is always a success envelope.
Request Parameters
Response
On success, the following response is returned in the common envelope format.
{
"response": {
"status": 0,
"content": "<div>...related HTML content...</div>",
"content_type": "html"
}
}
Each element of response is as follows:
Usage Example
Request example using curl:
curl "http://localhost:8080/api/v2/related-content?q=fess"