idstringbắt buộc
Hacker News story id, e.g. "47340079".
https://api.sandbase.ai/v1/api/hacker-news/story-commentsList the comments on a Hacker News story by id - text, author, and timestamp as clean JSON.
Đầu ra của bạn sẽ xuất hiện ở đây
Hoàn tất đầu vào, rồi nhấp Run.
Returns the comments on a Hacker News story as a flat list. Each comment has its author, text, timestamp, and the id of the item it replies to. You send the story id as input.
id and parentId of each comment.author.curl -X POST "https://api.sandbase.ai/v1/api/hacker-news/story-comments" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"id": "47340079"}'
The result is returned in outputs[0].data.
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Hacker News story id, e.g. "47340079". |
Real response for the request above, trimmed: lists keep their first item and long strings are cut.
{
"data": {
"comments": [
{
"author": "fcpguru",
"createdUtc": 1773257417,
"id": "47340089",
"parentId": "47340079",
"permalink": "https://news.ycombinator.com/item?id=47340089",
"postId": "47340079",
"text": "i agree but how is this ever going to be enforced verified? https://proofofhuman…"
}
]
},
"found": true
}
| Field | Meaning |
|---|---|
data.comments[].id | Id of the comment, as a string. |
data.comments[].author | Hacker News username of the person who wrote the comment. |
data.comments[].text | Text of the comment. |
data.comments[].createdUtc | Time the comment was posted, as a Unix timestamp in seconds. |
data.comments[].parentId | Id of the item this comment replies to. It equals the story id for top-level comments and another comment's id for replies. |
data.comments[].postId | Id of the story the comment belongs to. |
data.comments[].permalink | Link to the comment on news.ycombinator.com. |
found | true when the story was found. A lookup that finds nothing returns found: false. |
id is the number in the story URL, for example item?id=47340079.parentId, so group by parentId to build the thread tree.Billed at the actual cost of each call, about $0.0015 for the request above. Failed calls are not charged.
Bắt đầu xây dựng
Endpoint API của nền tảng với xác thực và theo dõi mức sử dụng thống nhất.
curl -X POST "https://api.sandbase.ai/v1/api/hacker-news/story-comments" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "47340079"
}'Đặt SandBase API key của bạn trong môi trường máy chủ. Các request sử dụng xác thực Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Giữ key của bạn trên máy chủ. Không hiển thị trong mã chạy trên trình duyệt.
idstringbắt buộcHacker News story id, e.g. "47340079".
Đây là phản hồi ví dụ đã lưu cho API này; không có request thực nào được gửi khi xem mục này.
Chưa có phản hồi đã lưu nào được công bố. Chạy API trong Playground để xem phản hồi.
Khám phá thêm
| API | Giá | Phản hồi |
|---|---|---|
Hacker News Story CommentsAPI này Hacker News | Từ $0.0015 mỗi lần gọi | JSON |
Hacker News | Từ $0.0015 mỗi lần gọi | JSON |
Hacker News | Từ $0.0015 mỗi lần gọi | JSON |
Hacker News | Từ $0.0015 mỗi lần gọi | JSON |
Câu hỏi
Gửi yêu cầu POST đến https://api.sandbase.ai/v1/api/hacker-news/story-comments với khóa API SandBase của bạn trong tiêu đề Authorization (Bearer) và các tham số trong phần thân JSON. Bạn cũng có thể thử trực tiếp trong Playground trên trang này mà không cần viết code.
Từ $0.0015 mỗi lần gọi, được tính từ số dư SandBase của bạn. Bạn chỉ bị tính phí cho các lần gọi bạn thực hiện; không có gói đăng ký.
Bắt buộc: id (string). Bảng Parameters và Playground trên trang này liệt kê mọi trường.
Phản hồi JSON được trả về trong cùng một yêu cầu HTTP (đồng bộ). README trên trang này có ví dụ phản hồi.
Không. Hacker News Story Comments chạy thông qua SandBase, nên chỉ cần một API key SandBase là đủ cho endpoint này và mọi API cùng model khác trong danh mục. Bạn không cần đăng ký riêng để có quyền truy cập API của Hacker News.