idstring必須
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.
出力はここに表示されます
入力を完了してから[実行]をクリックしてください。
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.
開発を始める
統一認証と使用状況の追跡を備えたプラットフォームAPIエンドポイントです。
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"
}'SandBaseのAPIキーをサーバー環境に設定してください。リクエストはBearer認証を使用します。
export SANDBASE_API_KEY="YOUR_API_KEY"キーはサーバー側で管理してください。ブラウザコードに公開しないでください。
idstring必須Hacker News story id, e.g. "47340079".
このAPIの保存済みサンプルレスポンスです。表示時にライブリクエストは行われません。
保存済みレスポンスはまだ公開されていません。PlaygroundでAPIを実行し、レスポンスを確認してください。
さらに探索
| API | 価格 | レスポンス |
|---|---|---|
Hacker News | 1回あたり $0.0015 から | JSON |
Hacker News | 1回あたり $0.0015 から | JSON |
Hacker News | 1回あたり $0.0015 から | JSON |
Hacker News | 1回あたり $0.0015 から | JSON |
質問
Authorization ヘッダー(Bearer)に SandBase API key を指定し、パラメータを JSON ボディで送信して https://api.sandbase.ai/v1/api/hacker-news/story-comments に POST リクエストを送ります。このページの Playground で、コードを書かずに試すこともできます。
1回あたり $0.0015 から、SandBase 残高から課金されます。課金対象はご利用分のみで、サブスクリプションはありません。
必須: id (string)。 このページの Parameters テーブルと Playground に、すべてのフィールドが一覧表示されています。
同じ HTTP リクエスト内で返される JSON レスポンスです(同期)。 このページの README にサンプルレスポンスがあります。
いいえ。Hacker News Story Comments は SandBase 経由で動作するため、SandBase の API key 1つでこのエンドポイントと、カタログ内の他のすべての API とモデルを利用できます。Hacker News の API アクセスを別途申請する必要はありません。