querystringобязательно
Search keyword, e.g. "ai".
https://api.sandbase.ai/v1/api/hacker-news/searchSearch Hacker News by keyword - matching stories with title, link, author, points, and comment count as clean JSON.
Ваш результат появится здесь
Заполните входные данные, затем нажмите «Запустить».
Returns Hacker News items that match a keyword. Each result has the title, link, author, points, comment count, and creation time. The only required input is query.
tags to look only at stories or only at comments.curl -X POST "https://api.sandbase.ai/v1/api/hacker-news/search" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "ai"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search keyword, e.g. "ai". |
tags | string | No | Optional result filter, e.g. "story" or "comment". |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"results": [
{
"author": "usefulposter",
"comments": 1668,
"createdUtc": 1773257369,
"id": "47340079",
"permalink": "https://news.ycombinator.com/item?id=47340079",
"points": 4229,
"title": "Don't post generated/AI-edited comments. HN is for conversation between humans",
"url": "https://news.ycombinator.com/newsguidelines.html#generated"
}
]
},
"found": true
}
| Field | Meaning |
|---|---|
data.results[].title | Title of the Hacker News post. |
data.results[].url | Link the post points to. This is the external page or guideline the author shared. |
data.results[].permalink | Link to the item's discussion page on Hacker News. |
data.results[].id | Hacker News item ID, returned as a string. |
data.results[].author | Hacker News username of the person who posted the item. |
data.results[].points | Score of the post. |
data.results[].comments | Number of comments on the post. |
data.results[].createdUtc | Creation time as a Unix timestamp in seconds. |
found | true when the search returned results. |
tags to a value such as story or comment to filter the result type.id value from a result as the input for Hacker News Story to get one post, or Hacker News Story Comments to read its discussion.author to Hacker News Profile to look up that user.Billed at the actual cost of each call, about $0.0015 for the request above. Failed calls are not charged.
Начните разработку
Конечная точка платформенного API с единообразной аутентификацией и учётом использования.
curl -X POST "https://api.sandbase.ai/v1/api/hacker-news/search" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query": "ai"
}'Укажите свой ключ SandBase API в окружении сервера. Запросы используют аутентификацию Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Храните ключ на сервере. Не раскрывайте его в коде браузера.
querystringобязательноSearch keyword, e.g. "ai".
tagsstringOptional result filter, e.g. "story" or "comment".
Сохранённый пример ответа для этого API; при просмотре живой запрос не выполняется.
Сохранённый ответ не опубликован. Запустите API в Playground, чтобы посмотреть его ответ.
Посмотреть больше
| API | Цена | Ответ |
|---|---|---|
Hacker News SearchЭтот API Hacker News | От $0.0015 за запрос | JSON |
Hacker News | От $0.0015 за запрос | JSON |
Hacker News | От $0.0015 за запрос | JSON |
Hacker News | От $0.0015 за запрос | JSON |
Вопросы
Отправьте POST-запрос на https://api.sandbase.ai/v1/api/hacker-news/search, указав ключ SandBase API в заголовке Authorization (Bearer), а параметры — в теле JSON. Вы также можете попробовать это в Playground на этой странице без написания кода.
От $0.0015 за вызов, списывается с баланса SandBase. Оплата взимается только за сделанные вызовы; подписка не требуется.
Обязательные: query (string). Необязательные: tags (string). В таблице Parameters и в Playground на этой странице перечислены все поля.
JSON-ответ, возвращаемый в том же HTTP-запросе (синхронно). В README на этой странице приведен пример ответа.
Нет. Hacker News Search работает через SandBase, поэтому один API key SandBase покрывает этот endpoint и все остальные API и модели в каталоге. Вам не нужно отдельно запрашивать доступ к API Hacker News.