公開API仕様
健常者エミュレータ事例集の投稿を、AIエージェント・外部クライアントから検索・取得するための公開API仕様です。 OpenAPI 3.1.0 準拠の機械可読版は /api/openapi.json から取得できます。
概要
- バージョン:
1.0.0 - ベースURL:
https://healthy-person-emulator.org - 認証: 不要(全エンドポイント公開)
- CORS:
Access-Control-Allow-Origin: * - レスポンス形式:
application/json; charset=utf-8 - キャッシュ:
Cache-Control: public, max-age=60, s-maxage=300
レート制限
明示的なレート制限はありませんが、Cloudflareにより異常なリクエストパターンは制限される可能性があります。 AIエージェントから大量に取得する場合は、postId ごとに数十ミリ秒の間隔を空けるなど、節度を持って利用してください。
共通エラーレスポンス
4xx系のエラーは全て以下の形式のJSONで返却されます。
| フィールド | 型 | nullable | 説明 |
|---|---|---|---|
error | string | エラーメッセージ |
エンドポイント一覧
- GET
/api/search— 投稿を検索する - GET
/api/posts/{postId}— 投稿の本文・コメント・タグ等を取得する - GET
/api/openapi.json— OpenAPI 3.1.0 仕様
GET /api/search
キーワード・タグで投稿一覧(タイトル・メタデータ)を取得します。
本文を取得するには、結果中の postId を GET /api/posts/{postId} に渡してください。
リクエスト
クエリパラメータ
| 名前 | 位置 | 型 | 必須 | 制約 / デフォルト | 説明 |
|---|---|---|---|---|---|
q | query | string | 任意 | デフォルト: "" | 検索キーワード。記事タイトル・本文を部分一致検索する。 |
tags | query | string | 任意 | デフォルト: "" | タグ名をスペース区切りで指定。複数指定時はAND条件で絞り込まれる。 |
orderby | query | string | 任意 | enum: timeDesc / timeAsc / like デフォルト: timeDesc | 並び順。不正な値はデフォルトにフォールバック。 |
page | query | integer | 任意 | 最小: 1 デフォルト: 1 | ページ番号(1始まり)。 |
pageSize | query | integer | 任意 | 最小: 1 / 最大: 50 デフォルト: 10 | 1ページあたりの件数。50を超える指定は50にクランプ。 |
リクエスト例
# キーワード検索
curl "https://healthy-person-emulator.org/api/search?q=挨拶&pageSize=5"
# タグ絞り込み+いいね順
curl "https://healthy-person-emulator.org/api/search?tags=コミュニケーション&orderby=like"
# ページング
curl "https://healthy-person-emulator.org/api/search?q=会話&page=2&pageSize=20"レスポンス
2xx 200 OK
SearchResult オブジェクト。
| フィールド | 型 | nullable | 説明 |
|---|---|---|---|
metadata | SearchMetadata | リクエスト条件のエコーバック・件数・ページング情報 | |
tagCounts | TagCount[] | 検索結果(フィルタなし版)に含まれるタグごとの件数。タグ絞り込みの参考用 | |
results | SearchHit[] | 投稿の配列 |
レスポンス例
{
"metadata": {
"query": "挨拶",
"count": 90,
"page": 1,
"totalPages": 9,
"orderby": "timeDesc",
"hasMore": true
},
"tagCounts": [
{ "tagName": "コミュニケーション", "count": 26 },
{ "tagName": "対人関係", "count": 23 }
],
"results": [
{
"postId": 32172,
"postTitle": "付き合いたい異性には自然に交際相手がいないか聞いてみると良い",
"postUrl": "https://healthy-person-emulator.org/archives/32172",
"postDateGmt": "2023-04-10T11:38:49.000Z",
"countLikes": 97,
"countDislikes": 2,
"countComments": 9,
"tagNames": ["恋愛", "対人関係", "人間関係"]
}
]
}GET /api/posts/{postId}
個別投稿の本文(HTML)・コメント一覧・タグ・類似投稿・前後の投稿を取得します。
リクエスト
パスパラメータ
| 名前 | 位置 | 型 | 必須 | 制約 / デフォルト | 説明 |
|---|---|---|---|---|---|
postId | path | integer | 必須 | 最小: 1 | 投稿ID。正の整数。 |
リクエスト例
curl "https://healthy-person-emulator.org/api/posts/32172"レスポンス
2xx 200 OK
Post オブジェクト。
| フィールド | 型 | nullable | 説明 |
|---|---|---|---|
postId | integer | 投稿ID | |
postTitle | string | タイトル | |
postUrl | string (uri) | 投稿の絶対URL | |
postDateGmt | string (date-time) | 投稿日時(ISO 8601, UTC) | |
postContentHtml | string | 投稿本文(HTML形式。サイト上の表示と同じマークアップ) | |
commentStatus | string | コメント受付状態(例: open, closed) | |
countLikes | integer | いいね数 | |
countDislikes | integer | 低評価数 | |
countBookmarks | integer | ブックマーク数 | |
countComments | integer | コメント数 | |
ogpImageUrl | string (uri) | ✓ | OGP画像のURL。未生成の場合は null |
isWelcomed | boolean | ✓ | AIによるコンテンツフィルターの結果 |
isWelcomedExplanation | string | ✓ | AIによるコンテンツフィルターの判定理由 |
tags | Tag[] | 紐づくタグ | |
comments | Comment[] | コメント一覧 | |
similarPosts | PostSummary[] | 類似した投稿 | |
previousPost | PostSummary | ✓ | 前の投稿。先頭なら null |
nextPost | PostSummary | ✓ | 次の投稿。末尾なら null |
4xx 400 Bad Request
postId が正の整数でない場合(非数値・0以下など)。
{ "error": "postId must be a positive integer" }4xx 404 Not Found
該当する postId の投稿が存在しない場合。
{ "error": "Post not found" }GET /api/openapi.json
本APIのOpenAPI 3.1.0 仕様を機械可読なJSONで返します。 コード生成ツール(openapi-generator、orval等)やAIエージェントから直接読み込めます。
curl "https://healthy-person-emulator.org/api/openapi.json"スキーマ定義
各エンドポイントで再利用される型の定義です。
SearchMetadata
| フィールド | 型 | nullable | 説明 |
|---|---|---|---|
query | string | リクエストの q の値 | |
count | integer | 総ヒット件数 | |
page | integer | 現在のページ番号(1始まり) | |
totalPages | integer | 総ページ数 | |
orderby | enum (timeDesc / timeAsc / like) | 適用された並び順 | |
hasMore | boolean | 次ページが存在するか |
TagCount
| フィールド | 型 | nullable | 説明 |
|---|---|---|---|
tagName | string | タグ名 | |
count | integer | 件数 |
SearchHit
| フィールド | 型 | nullable | 説明 |
|---|---|---|---|
postId | integer | 投稿ID | |
postTitle | string | タイトル | |
postUrl | string (uri) | 投稿の絶対URL | |
postDateGmt | string (date-time) | 投稿日時(ISO 8601, UTC) | |
countLikes | integer | いいね数 | |
countDislikes | integer | 低評価数 | |
countComments | integer | コメント数 | |
tagNames | string[] | 紐づくタグ名 |
Tag
| フィールド | 型 | nullable | 説明 |
|---|---|---|---|
tagName | string | タグ名 | |
tagId | integer | タグID |
Comment
| フィールド | 型 | nullable | 説明 |
|---|---|---|---|
commentId | integer | コメントID | |
commentDateGmt | string (date-time) | コメント投稿日時(ISO 8601, UTC) | |
commentAuthor | string | 投稿者名 | |
commentContent | string | コメント本文 | |
likesCount | integer | いいね数 | |
dislikesCount | integer | 低評価数 | |
commentParent | integer | 親コメントID(トップレベルは 0) |
PostSummary
| フィールド | 型 | nullable | 説明 |
|---|---|---|---|
postId | integer | 投稿ID | |
postTitle | string | タイトル | |
postUrl | string (uri) | 投稿の絶対URL |
Error
| フィールド | 型 | nullable | 説明 |
|---|---|---|---|
error | string | エラーメッセージ |