View Thread Details
GET /threads/{threadId}
Fetch thread details from the forum.
Path Params
threadId: thread-unique_id
Response
200 OK
Simplified Response Body
{
"status": "string",
"data": {
"thread": {
...Thread,
"comments": [
{
...CommentOrReply,
"likeCount": "int",
"replies": [
CommentOrReply,
CommentOrReply
]
}
]
}
}
}
Thread
{
"id": "string",
"title": "string",
"body": "string",
"date": "date",
"username": "string"
}
CommentOrReply
{
"id": "string",
"username": "string",
"date": "date",
"content": "string"
}
Response Body Example
{
"status": "success",
"data": {
"thread": {
"id": "thread--sOkeyiQbiReGR4OOdfgK",
"title": "sebuah thread",
"body": "sebuah body thread",
"date": "2023-06-17T15:10:13.329Z",
"username": "dicoding",
"comments": [
{
"id": "comment-qup952IMTa9wfknxEbH-s",
"username": "dicoding",
"date": "2023-06-17T15:10:13.413Z",
"content": "sebuah comment",
"likeCount": 2,
"replies": [
{
"id": "reply-vZG9EVKV5XzBFakg-M6Bd",
"username": "johndoe",
"date": "2023-06-17T15:10:13.956Z",
"content": "**balasan telah dihapus**"
},
{
"id": "reply-mw4raqNU4_mi7nQyWMDOx",
"username": "dicoding",
"date": "2023-06-17T15:10:14.036Z",
"content": "sebuah balasan"
}
]
},
{
"id": "comment-g1AYNec8_qzV_hhc8530j",
"username": "dicoding",
"date": "2023-06-17T15:10:13.504Z",
"content": "**komentar telah dihapus**",
"likeCount": 0,
"replies": []
}
]
}
}
}