1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-11-04 13:31:45 +03:00

API: Added examples for comments

Tweaked comment repo to avoid returning a lot of extra data on API
update responses.
This commit is contained in:
Dan Brown
2025-10-24 15:14:25 +01:00
parent 9c4a9225af
commit a949900570
8 changed files with 176 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
{
"page_id": 2646,
"html": "<p>Can the title be updated?</p>",
"content_ref": "bkmrk-page-title:7341676876991010:3-14"
}

View File

@@ -0,0 +1,4 @@
{
"html": "<p>Can this comment be updated??????</p>",
"archived": true
}

View File

@@ -0,0 +1,13 @@
{
"id": 167,
"commentable_id": 2646,
"commentable_type": "page",
"parent_id": null,
"local_id": 29,
"created_by": 1,
"updated_by": 1,
"created_at": "2025-10-24T14:05:41.000000Z",
"updated_at": "2025-10-24T14:05:41.000000Z",
"content_ref": "bkmrk-page-title:7341676876991010:3-14",
"archived": false
}

View File

@@ -0,0 +1,29 @@
{
"data": [
{
"id": 1,
"commentable_id": 2607,
"commentable_type": "page",
"parent_id": null,
"local_id": 1,
"content_ref": "",
"created_by": 1,
"updated_by": 1,
"created_at": "2022-04-20T08:43:27.000000Z",
"updated_at": "2022-04-20T08:43:27.000000Z"
},
{
"id": 18,
"commentable_id": 2607,
"commentable_type": "page",
"parent_id": 1,
"local_id": 2,
"content_ref": "",
"created_by": 3,
"updated_by": 3,
"created_at": "2022-11-15T08:12:35.000000Z",
"updated_at": "2022-11-15T08:12:35.000000Z"
}
],
"total": 88
}

View File

@@ -0,0 +1,38 @@
{
"id": 22,
"commentable_id": 2646,
"commentable_type": "page",
"html": "<p>This page looks great!<\/p>\n",
"parent_id": null,
"local_id": 2,
"created_by": {
"id": 1,
"name": "Admin",
"slug": "admin"
},
"updated_by": {
"id": 1,
"name": "Admin",
"slug": "admin"
},
"created_at": "2023-06-07T07:50:56.000000Z",
"updated_at": "2023-06-07T07:50:56.000000Z",
"content_ref": "",
"archived": false,
"replies": [
{
"id": 34,
"commentable_id": 2646,
"commentable_type": "page",
"html": "<p>Thanks for the comment!<\/p>\n",
"parent_id": 2,
"local_id": 10,
"created_by": 2,
"updated_by": 2,
"created_at": "2023-06-07T13:46:25.000000Z",
"updated_at": "2023-06-07T13:46:25.000000Z",
"content_ref": "",
"archived": false
}
]
}

View File

@@ -0,0 +1,13 @@
{
"id": 167,
"commentable_id": 2646,
"commentable_type": "page",
"parent_id": null,
"local_id": 29,
"created_by": 1,
"updated_by": 1,
"created_at": "2025-10-24T14:05:41.000000Z",
"updated_at": "2025-10-24T14:09:56.000000Z",
"content_ref": "bkmrk-page-title:7341676876991010:3-14",
"archived": true
}

View File

@@ -29,6 +29,79 @@
"revision_count": 5,
"template": false,
"editor": "wysiwyg",
"comments": {
"active": [
{
"comment": {
"id": 22,
"commentable_id": 306,
"commentable_type": "page",
"html": "<p>Does this need revising?<\/p>\n",
"parent_id": null,
"local_id": 1,
"created_by": {
"id": 1,
"name": "Admin",
"slug": "admin"
},
"updated_by": 1,
"created_at": "2023-06-07T07:50:56.000000Z",
"updated_at": "2023-06-07T07:50:56.000000Z",
"content_ref": "",
"archived": false
},
"depth": 0,
"children": [
{
"comment": {
"id": 34,
"commentable_id": 2646,
"commentable_type": "page",
"html": "<p>I think it's okay!<\/p>\n",
"parent_id": 1,
"local_id": 2,
"created_by": {
"id": 2,
"name": "Editor",
"slug": "editor"
},
"updated_by": 1,
"created_at": "2023-06-07T13:46:25.000000Z",
"updated_at": "2023-06-07T13:46:25.000000Z",
"content_ref": "",
"archived": false
},
"depth": 1,
"children": []
}
]
}
],
"archived": [
{
"comment": {
"id": 21,
"commentable_id": 2646,
"commentable_type": "page",
"html": "<p>The title needs to be fixed<\/p>\n",
"parent_id": null,
"local_id": 3,
"created_by": {
"id": 2,
"name": "Editor",
"slug": "editor"
},
"updated_by": 1,
"created_at": "2023-06-07T07:50:49.000000Z",
"updated_at": "2025-10-24T08:37:22.000000Z",
"content_ref": "",
"archived": true
},
"depth": 0,
"children": []
}
]
},
"tags": [
{
"name": "Category",