# ノートへのコメント投稿

`POST /api/note/{noteId}/comment`

URL: https://repsona.com/ja/api/post-note-noteid-comment

エディタの文書 (TipTap JSON) か Markdown の文字列でコメントを投稿します。保存は Markdown です。

## パラメーター

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `noteId` | path | integer | 必須 | ノートの ID |

## リクエストボディ

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `doc` | body | object |  | コメントをエディタのドキュメント (ProseMirror JSON。ルートは `type: "doc"`) で渡します。`doc` か `markdown` のどちらかを渡してください。両方ある場合は `markdown` が使われます。 |
| `markdown` | body | string |  | コメントを Markdown (20,000 文字まで) で渡します。`doc` か `markdown` のどちらかを渡してください。 |
| `parentId` | body | integer \| null |  | 返信先のコメントの ID。省略するか `null` にすると、最上位のコメントになります。 |

## リクエスト

```sh
curl -X POST "https://<space>.repsona.com/api/note/{noteId}/comment" \
  -H "Authorization: Bearer $REPSONA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "markdown": "Action items are listed below.",
    "parentId": null
  }'
```

## レスポンス

- 200: Created comment
- 400: Empty body or invalid parent
- 401: Authentication is required
- 403: Not a project member
- 404: Note not found

## レスポンスの例

```json
{
  "comment": {
    "id": 37,
    "parentId": null,
    "comment": "Action items are listed below.",
    "createdAt": 1793662651378,
    "updatedAt": 1793662651378,
    "user": {
      "id": 1126,
      "name": "reon",
      "fullName": "Reon Walls",
      "avatarUrl": null,
      "color": null,
      "state": "active"
    },
    "files": [],
    "deleted": false,
    "reactions": [],
    "children": []
  }
}
```
