Loading...
 
Skip to main content

History: Api Comments Doc

Source of version: 7 (current)

Copy to clipboard
{DIV(class="content-section d-none" id="get-comments")}
!!! Get all comments

{TABS(name="doc-get-comments" tabs="Request URL| cURL | PHP | JavaScript | Response" toggle="y" inside_pretty="n")}
{DIV()}
{CODE(caption="Request URL - comments" colors="http" theme="default")}https://example.com/api/comments{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="cURL - comments" colors="http" theme="default")}
curl -X 'GET' \
  'https://example.com/api/comments?type=article&objectId=1&offset=0&maxRecords=5' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer xxxxx'
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="PHP - comments" colors="http" theme="default")}
<?php
$url = 'https://example.com/api/comments?type=article&objectId=1&offset=0&maxRecords=5';

$headers = [
    'Accept: application/json',
    'Authorization: Bearer xxxxx'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);

if (curl_errno($ch)) {
  $error_msg = curl_error($ch);
  echo 'Error: ' . $error_msg;
} else {
   $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
      if ($http_code === 200) {
          $data = json_decode($response, true);
          print_r($data);
      } else {
          echo 'Error: HTTP status code ' . $http_code;
      }
}
curl_close($ch);
?>
{CODE}
{DIV}


/////
{DIV()}
{CODE(caption="Javascript - comments" colors="http" theme="default")}
    const url = 'https://example.com/api/comments?type=article&objectId=1&offset=0&maxRecords=5';

    fetch(url, {
        method: 'GET',
        headers: {
          'Accept': 'application/json',
          'Authorization': 'Bearer xxxxx'
        }
      })
      .then(res => {
        if (!res.ok) throw new Error("HTTP " + res.status);
        return res.json();
      })
      .then(data => {
        console.log(data);
      })
      .catch(err => {
         console.log('Fetch error: ' + err.message);
      });
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Response - comments" colors="http" theme="default")}
{
  "title": "Comments",
  "comments": [
    {
      "threadId": 7,
      "object": "1",
      "objectType": "article",
      "parentId": 0,
      "userName": "admin",
      "commentDate": 1754168128,
      "hits": 0,
      "type": "n",
      "points": "0.00",
      "votes": 0,
      "average": "0.0000",
      "title": "Untitled",
      "data": "Hey, first comment",
      "email": "",
      "website": "",
      "user_ip": "::1",
      "summary": "",
      "smiley": null,
      "message_id": "admin-0-333ff4a0b7@localhost",
      "in_reply_to": "",
      "comment_rating": null,
      "archived": null,
      "approved": "y",
      "locked": "n",
      "grandFather": 0,
      "replies_info": {
        "replies": [
          {
            "threadId": 8,
            "object": "1",
            "objectType": "article",
            "parentId": 7,
            "userName": "admin",
            "commentDate": 1754168138,
            "hits": 0,
            "type": "n",
            "points": "0.00",
            "votes": 0,
            "average": "0.0000",
            "title": "Untitled",
            "data": "Good",
            "email": "",
            "website": "",
            "user_ip": "::1",
            "summary": "",
            "smiley": null,
            "message_id": "admin-7-f5b8fc3444@localhost",
            "in_reply_to": "admin-0-333ff4a0b7@localhost",
            "comment_rating": null,
            "archived": null,
            "approved": "y",
            "locked": "n",
            "parsed": "Good",
            "user_posts": 9,
            "user_level": 5,
            "user_email": "",
            "attachments": [],
            "is_reported": 0,
            "user_online": "n",
            "user_exists": 1,
            "replies_info": {
              "replies": [],
              "numReplies": 0,
              "totalReplies": 0
            },
            "level": 0,
            "can_edit": true
          }
        ],
        "numReplies": 1,
        "totalReplies": 1
      },
      "isEmpty": "n",
      "version": 0,
      "diffInfo": [],
      "replies_flat": [
        {
          "threadId": 8,
          "object": "1",
          "objectType": "article",
          "parentId": 7,
          "userName": "admin",
          "commentDate": 1754168138,
          "hits": 0,
          "type": "n",
          "points": "0.00",
          "votes": 0,
          "average": "0.0000",
          "title": "Untitled",
          "data": "Good",
          "email": "",
          "website": "",
          "user_ip": "::1",
          "summary": "",
          "smiley": null,
          "message_id": "admin-7-f5b8fc3444@localhost",
          "in_reply_to": "admin-0-333ff4a0b7@localhost",
          "comment_rating": null,
          "archived": null,
          "approved": "y",
          "locked": "n",
          "parsed": "Good",
          "user_posts": 9,
          "user_level": 5,
          "user_email": "",
          "attachments": [],
          "is_reported": 0,
          "user_online": "n",
          "user_exists": 1,
          "replies_info": {
            "replies": [],
            "numReplies": 0,
            "totalReplies": 0
          },
          "level": 0,
          "can_edit": true
        }
      ],
      "parsed": "Hey, first comment",
      "user_posts": 9,
      "user_level": 5,
      "user_email": "",
      "attachments": [],
      "is_reported": 0,
      "user_online": "n",
      "user_exists": 1,
      "can_edit": true
    },
    {
      "threadId": 9,
      "object": "1",
      "objectType": "article",
      "parentId": 0,
      "userName": "admin",
      "commentDate": 1754168149,
      "hits": 0,
      "type": "n",
      "points": "0.00",
      "votes": 0,
      "average": "0.0000",
      "title": "Untitled",
      "data": "Second comment",
      "email": "",
      "website": "",
      "user_ip": "::1",
      "summary": "",
      "smiley": null,
      "message_id": "admin-0-b45ea10f1f@localhost",
      "in_reply_to": "",
      "comment_rating": null,
      "archived": null,
      "approved": "y",
      "locked": "n",
      "grandFather": 0,
      "replies_info": {
        "replies": [],
        "numReplies": 0,
        "totalReplies": 0
      },
      "isEmpty": "n",
      "version": 0,
      "diffInfo": [],
      "replies_flat": [],
      "parsed": "Second comment",
      "user_posts": 9,
      "user_level": 5,
      "user_email": "",
      "attachments": [],
      "is_reported": 0,
      "user_online": "n",
      "user_exists": 1,
      "can_edit": true
    }
  ],
  "type": "article",
  "objectId": "1",
  "parentId": 0,
  "count": 3,
  "offset": 0,
  "maxRecords": 5,
  "sortMode": "commentDate_asc",
  "allow_post": true,
  "allow_remove": true,
  "allow_lock": true,
  "allow_unlock": false,
  "allow_archive": true,
  "allow_moderate": true,
  "allow_vote": false
}
{CODE}
{DIV}

{TABS}

!!!! Parameters

* __type__ ''string'' ~~#fe0000:*~~: Object type to get comments from. Possible values are:
** ~~#9011ff:__wiki page__~~, ~~#9011ff:__file gallery__~~, ~~#9011ff:__poll__~~, ~~#9011ff:__faq__~~, ~~#9011ff:__blog post__~~, ~~#9011ff:__trackeritem__~~, ~~#9011ff:__article__~~, ~~#9011ff:__activity__~~

* __objectId__ ''integer'' ~~#fe0000:*~~:  Object ID to get comments from

* __offset__ ''integer'' ~~#fe0000:*~~:  Offset to start from

* __maxRecords__ ''integer'' ~~#fe0000:*~~:  Maximum number of records to return

{DIV}





{DIV(class="content-section d-none" id="create-comments")}
!!! Create a new comment.

{TABS(name="doc-create-comments" tabs="Request URL| cURL | PHP | JavaScript | Response" toggle="y" inside_pretty="n")}
{DIV()}
{CODE(caption="Request URL - comments" colors="http" theme="default")}https://example.com/api/comments{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="cURL - comments" colors="http" theme="default")}
curl -X 'POST' \
  'https://example.com/api/comments' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Authorization: Bearer xxxxx' \
  -d 'parentId=9' \
  -d 'title=My Reply' \
  -d 'data=Hello test' \
  -d 'objectId=1' \
  -d 'type=article'
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="PHP - comments" colors="http" theme="default")}
<?php
$url = 'https://example.com/api/comments';

$data = http_build_query([
    'parentId' => 9,
    'title' => 'My Reply',
    'data' => 'Hello test',
    'objectId' => 1,
    'type' => 'article'
]);

$headers = [
    'Accept: application/json',
    'Content-Type: application/x-www-form-urlencoded',
    'Authorization: Bearer xxxxx'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($ch);

if (curl_errno($ch)) {
  $error_msg = curl_error($ch);
  echo 'Error: ' . $error_msg;
} else {
   $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
      if ($http_code === 200) {
          $data = json_decode($response, true);
          print_r($data);
      } else {
          echo 'Error: HTTP status code ' . $http_code;
      }
}
curl_close($ch);
?>
{CODE}
{DIV}


/////
{DIV()}
{CODE(caption="Javascript - comments" colors="http" theme="default")}
    const formData = new URLSearchParams();
    formData.append('parentId', '9');
    formData.append('title', 'My Reply');
    formData.append('data', 'Hello test');
    formData.append('objectId', '1');
    formData.append('type', 'article');

    fetch('https://example.com/api/comments', {
        method: 'POST',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/x-www-form-urlencoded',
          'Authorization': 'Bearer xxxxx'
        },
        body: formData.toString()
      })
      .then(res => {
        if (!res.ok) throw new Error("HTTP " + res.status);
        return res.json();
      })
      .then(data => {
        console.log(data);
      })
      .catch(err => {
         console.log('Fetch error: ' + err.message);
      });
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Response - comments" colors="http" theme="default")}
{
    "threadId": "13",
    "parentId": 9,
    "type": "article",
    "objectId": "1",
    "feedback": []
}
{CODE}
{DIV}

{TABS}

!!!! Request body

* __type__ ''string'' ~~#fe0000:*~~: Object type on which to create the comment. Possible values are:
** ~~#9011ff:__wiki page__~~, ~~#9011ff:__file gallery__~~, ~~#9011ff:__poll__~~, ~~#9011ff:__faq__~~, ~~#9011ff:__blog post__~~, ~~#9011ff:__trackeritem__~~, ~~#9011ff:__article__~~, ~~#9011ff:__activity__~~

* __objectId__ ''integer'' ~~#fe0000:*~~:  Object ID on which to create the comment

* __offset__ ''integer'' ~~#fe0000:*~~:  Offset to start from

* __parentId__ ''integer'' ''Optional'':  Parent comment ID

* __version__ ''integer'' ''Optional'':  Comment version. By default, it is 0

* __title__ ''string'' ''Optional'':  Comment title

* __data__ ''string'' ''Optional'':  Comment wiki content

* __watch__ ''string'' ''Optional'':  Tiki boolean use format y/n

* __anonymous_name__ ''string'' ''Optional'':  Anonymous user name

* __anonymous_email__ ''string'' ''Optional'':  Anonymous user email

* __ anonymous_website__ ''string'' ''Optional'':  Anonymous user website

{DIV}




{DIV(class="content-section d-none" id="update-comments")}
!!! Create a new comment.

{TABS(name="doc-update-comments" tabs="Request URL| cURL | PHP | JavaScript | Response" toggle="y" inside_pretty="n")}
{DIV()}
{CODE(caption="Request URL - comments" colors="http" theme="default")}https://example.com/api/comments/{threadId}{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="cURL - comments" colors="http" theme="default")}
curl -X 'POST' \
  'https://example.com/api/comments/14' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Authorization: Bearer xxxxx' \
  -d 'title=Updated Title' \
  -d 'data=Updated content'
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="PHP - comments" colors="http" theme="default")}
<?php
$url = 'https://example.com/api/comments/14';

$data = http_build_query([
    'title' => 'Updated Title',
    'data' => 'Updated content',
]);

$headers = [
    'Accept: application/json',
    'Content-Type: application/x-www-form-urlencoded',
    'Authorization: Bearer xxxxx'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($ch);

if (curl_errno($ch)) {
  $error_msg = curl_error($ch);
  echo 'Error: ' . $error_msg;
} else {
   $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
      if ($http_code === 200) {
          $data = json_decode($response, true);
          print_r($data);
      } else {
          echo 'Error: HTTP status code ' . $http_code;
      }
}
curl_close($ch);
?>
{CODE}
{DIV}


/////
{DIV()}
{CODE(caption="Javascript - comments" colors="http" theme="default")}
    const formData = new URLSearchParams();
    formData.append('title', 'Updated title');
    formData.append('data', 'Updated content');

    fetch('https://example.com/api/comments/14', {
        method: 'POST',
        headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/x-www-form-urlencoded',
          'Authorization': 'Bearer xxxxx'
        },
        body: formData.toString()
      })
      .then(res => {
        if (!res.ok) throw new Error("HTTP " + res.status);
        return res.json();
      })
      .then(data => {
        console.log(data);
      })
      .catch(err => {
         console.log('Fetch error: ' + err.message);
      });
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Response - comments" colors="http" theme="default")}
{
  "threadId": 14,
  "comment": {
    "threadId": 14,
    "object": "1",
    "objectType": "article",
    "parentId": 9,
    "userName": "admin",
    "commentDate": 1754173243,
    "hits": 0,
    "type": "n",
    "points": "0.00",
    "votes": 0,
    "average": "0.0000",
    "title": "Updated title",
    "data": "Updated content",
    "email": "",
    "website": "",
    "user_ip": "::1",
    "summary": "",
    "smiley": "",
    "message_id": "admin-9-a2d3a35adf@localhost",
    "in_reply_to": "admin-0-b45ea10f1f@localhost",
    "comment_rating": 0,
    "archived": null,
    "approved": "y",
    "locked": "n",
    "parsed": "Hello test Updated",
    "user_posts": 14,
    "user_level": 5,
    "user_email": "",
    "attachments": [],
    "is_reported": 0,
    "user_online": "n",
    "user_exists": 1
  }
}
{CODE}
{DIV}

{TABS}

!!!! Request body

* __title__ ''string'' ''Optional'':  Comment title

* __data__ ''string'' ''Optional'':  Comment wiki content

{DIV}




{DIV(class="content-section d-none" id="delete-comments")}
!!! Remove a comment.

{TABS(name="doc-delete-comments" tabs="Request URL| cURL | PHP | JavaScript | Response" toggle="y" inside_pretty="n")}
{DIV()}
{CODE(caption="Request URL - comments" colors="http" theme="default")}https://example.com/api/comments/{threadId}{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="cURL - comments" colors="http" theme="default")}
curl -X 'DELETE' \
  'https://example.com/api/comments/14' \
  -H 'Authorization: Bearer xxxxx' \
  -H 'accept: application/json'
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="PHP - comments" colors="http" theme="default")}
<?php
$url = 'https://example.com/api/comments/14';

$headers = [
    'Accept: application/json',
    'Authorization: Bearer xxxxx'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);

if (curl_errno($ch)) {
  $error_msg = curl_error($ch);
  echo 'Error: ' . $error_msg;
} else {
   $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
      if ($http_code === 200) {
          $data = json_decode($response, true);
          print_r($data);
      } else {
          echo 'Error: HTTP status code ' . $http_code;
      }
}
curl_close($ch);
?>
{CODE}
{DIV}


/////
{DIV()}
{CODE(caption="Javascript - comments" colors="http" theme="default")}
    fetch('https://example.com/api/comments/14', {
        method: 'DELETE',
        headers: {
          'Accept': 'application/json',
          'Authorization': 'Bearer xxxxx'
        }
      })
      .then(res => {
        if (!res.ok) throw new Error("HTTP " + res.status);
        return res.json();
      })
      .then(data => {
        console.log(data);
      })
      .catch(err => {
         console.log('Fetch error: ' + err.message);
      });
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Response - comments" colors="http" theme="default")}
{
    "threadId": 14,
    "status": "DONE",
    "objectType": "article",
    "objectId": "1",
    "parsed": "Content test"
}
{CODE}
{DIV}

{TABS}

!!!! Parameters

* __threadId__ ''string'' ~~#fe0000:*~~: Comment thread ID

{DIV}


{DIV(class="content-section d-none" id="lock-comments")}
!!! Lock a comment thread.

{TABS(name="doc-lock-comments" tabs="Request URL| cURL | PHP | JavaScript | Response" toggle="y" inside_pretty="n")}

{DIV()}
{CODE(caption="Request URL - comments" colors="http" theme="default")}
https://example.com/api/comments/{threadId}/lock
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="cURL - comments" colors="http" theme="default")}
curl -X 'POST' \
  'https://example.com/api/comments/23/lock' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer xxxxx' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'type=wiki%20page&objectId=test-page'
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="PHP - comments" colors="php" theme="default")}
<?php

$url = 'https://example.com/api/comments/23/lock';

$data = http_build_query([
    'type' => 'wiki page',
    'objectId' => 'test-page'
]);

$headers = [
    'Accept: application/json',
    'Content-Type: application/x-www-form-urlencoded',
    'Authorization: Bearer xxxxx'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if ($status === 200) {
        $data = json_decode($response, true);
        print_r($data);
    } else {
        echo "Error: HTTP status code $status\n";
        echo $response;
    }
}

curl_close($ch);
?>
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Javascript - comments" colors="javascript" theme="default")}

const formData = new URLSearchParams();
formData.append('type', 'wiki page');
formData.append('objectId', 'test-page');

fetch('https://example.com/api/comments/23/lock', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Authorization': 'Bearer xxxxx'
  },
  body: formData.toString()
})
.then(response => {
  if (!response.ok) throw new Error("HTTP " + response.status);
  return response.json();
})
.then(data => console.log(data))
.catch(error => console.error("Fetch error:", error));

{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Response - comments" colors="json" theme="default")}
{
"title": "Lock comments",
"type": "wiki page",
"objectId": "test-page",
"status": "DONE"
}
{CODE}
{DIV}

{TABS}

!!!! Parameters

* __threadId__ ''integer'' ~~#fe0000:*~~: The comment thread ID.
* __type__ ''string'' ~~#fe0000:*~~: The type of the object (~~#9011ff:__wiki page__~~, ~~#9011ff:__file gallery__~~, ~~#9011ff:__poll__~~, ~~#9011ff:__faq__~~, ~~#9011ff:__blog post__~~, ~~#9011ff:__trackeritem__~~, ~~#9011ff:__article__~~, ~~#9011ff:__activity__~~)
* __objectId__ ''string'' ~~#fe0000:*~~: The object ID associated with the comment thread.

{DIV}

{DIV(class="content-section d-none" id="unlock-comments")}
!!! Unlock a comment thread.

{TABS(name="doc-unlock-comments" tabs="Request URL| cURL | PHP | JavaScript | Response" toggle="y" inside_pretty="n")}

{DIV()}
{CODE(caption="Request URL - comments" colors="http" theme="default")}
https://example.com/api/comments/{threadId}/unlock
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="cURL - comments" colors="http" theme="default")}
curl -X 'POST' \
  'https://example.com/api/comments/23/unlock' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer xxxxx' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'type=wiki%20page&objectId=test-page'
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="PHP - comments" colors="php" theme="default")}
<?php

$url = 'https://example.com/api/comments/23/unlock';

$data = http_build_query([
    'type' => 'wiki page',
    'objectId' => 'test-page'
]);

$headers = [
    'Accept: application/json',
    'Content-Type: application/x-www-form-urlencoded',
    'Authorization: Bearer xxxxx'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if ($status === 200) {
        $data = json_decode($response, true);
        print_r($data);
    } else {
        echo "Error: HTTP status code $status\n";
        echo $response;
    }
}

curl_close($ch);
?>
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Javascript - comments" colors="javascript" theme="default")}

const formData = new URLSearchParams();
formData.append('type', 'wiki page');
formData.append('objectId', 'test-page');

fetch('https://example.com/api/comments/23/unlock', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Authorization': 'Bearer xxxxx'
  },
  body: formData.toString()
})
.then(response => {
  if (!response.ok) throw new Error("HTTP " + response.status);
  return response.json();
})
.then(data => console.log(data))
.catch(error => console.error("Fetch error:", error));

{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Response - comments" colors="json" theme="default")}
{
"title": "Unlock comments",
"type": "wiki page",
"objectId": "test-page",
"status": "DONE"
}
{CODE}
{DIV}

{TABS}

!!!! Parameters

* __threadId__ ''integer'' ~~#fe0000:*~~: The comment thread ID.
* __type__ ''string'' ~~#fe0000:*~~: The type of the object (~~#9011ff:__wiki page__~~, ~~#9011ff:__file gallery__~~, ~~#9011ff:__poll__~~, ~~#9011ff:__faq__~~, ~~#9011ff:__blog post__~~, ~~#9011ff:__trackeritem__~~, ~~#9011ff:__article__~~, ~~#9011ff:__activity__~~)
* __objectId__ ''string'' ~~#fe0000:*~~: The object ID associated with the comment thread.

{DIV}


{DIV(class="content-section d-none" id="approve-comments")}
!!! Moderate comment - approve

{TABS(name="doc-approve-comments" tabs="Request URL| cURL | PHP | JavaScript | Response" toggle="y" inside_pretty="n")}

{DIV()}
{CODE(caption="Request URL - comments" colors="http" theme="default")}
https://example.com/api/comments/{threadId}/approve
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="cURL - comments" colors="http" theme="default")}
curl -X 'POST' \
  'https://example.com/api/comments/23/approve' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer xxxxx'
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="PHP - comments" colors="php" theme="default")}
<?php

$url = 'https://example.com/api/comments/23/approve';

$headers = [
    'Accept: application/json',
    'Authorization: Bearer xxxxx'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, '');

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if ($status === 200) {
        $data = json_decode($response, true);
        print_r($data);
    } else {
        echo "Error: HTTP status code $status\n";
        echo $response;
    }
}

curl_close($ch);
?>

{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Javascript - comments" colors="javascript" theme="default")}
fetch('https://example.com/api/comments/23/approve', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer xxxxx'
  }
})
.then(response => {
  if (!response.ok) throw new Error("HTTP " + response.status);
  return response.json();
})
.then(data => console.log(data))
.catch(error => console.error("Fetch error:", error));

{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Response - comments" colors="json" theme="default")}
{
  "threadId": 23,
  "type": "wiki page",
  "objectId": "test-page",
  "status": "DONE",
  "do": "APPROVE"
}
{CODE}
{DIV}

{TABS}

!!!! Parameters

* __threadId__ ''integer'' ~~#fe0000:*~~: The comment thread ID.

{DIV}


{DIV(class="content-section d-none" id="reject-comments")}
!!! Moderate comment - reject

{TABS(name="doc-reject-comments" tabs="Request URL| cURL | PHP | JavaScript | Response" toggle="y" inside_pretty="n")}

{DIV()}
{CODE(caption="Request URL - comments" colors="http" theme="default")}
https://example.com/api/comments/{threadId}/reject
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="cURL - comments" colors="http" theme="default")}
curl -X 'POST' \
  'https://example.com/api/comments/23/reject' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer xxxxx'

{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="PHP - comments" colors="php" theme="default")}
<?php

$url = 'https://example.com/api/comments/23/reject';

$headers = [
    'Accept: application/json',
    'Authorization: Bearer xxxxx'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, '');

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if ($status === 200) {
        $data = json_decode($response, true);
        print_r($data);
    } else {
        echo "Error: HTTP status code $status\n";
        echo $response;
    }
}

curl_close($ch);
?>


{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Javascript - comments" colors="javascript" theme="default")}
fetch('https://example.com/api/comments/23/reject', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer xxxxx'
  }
})
.then(response => {
  if (!response.ok) throw new Error("HTTP " + response.status);
  return response.json();
})
.then(data => console.log(data))
.catch(error => console.error("Fetch error:", error));

{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Response - comments" colors="json" theme="default")}
{
  "threadId": 23,
  "type": "wiki page",
  "objectId": "test-page",
  "status": "DONE",
  "do": "REJECT"
}

{CODE}
{DIV}

{TABS}

!!!! Parameters

* __threadId__ ''integer'' ~~#fe0000:*~~: The comment thread ID.

{DIV}

{DIV(class="content-section d-none" id="archive-comments")}
!!! Archive comment

{TABS(name="doc-archive-comments" tabs="Request URL| cURL | PHP | JavaScript | Response" toggle="y" inside_pretty="n")}

{DIV()}
{CODE(caption="Request URL - comments" colors="http" theme="default")}
https://example.com/api/comments/{threadId}/archive
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="cURL - comments" colors="http" theme="default")}
curl -X 'POST' \
  'https://example.com/api/comments/23/archive' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer xxxxx'
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="PHP - comments" colors="php" theme="default")}
<?php

$url = 'https://example.com/api/comments/23/archive';

$headers = [
    'Accept: application/json',
    'Authorization: Bearer xxxxx'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, '');

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if ($status === 200) {
        $data = json_decode($response, true);
        print_r($data);
    } else {
        echo "Error: HTTP status code $status\n";
        echo $response;
    }
}

curl_close($ch);
?>

{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Javascript - comments" colors="javascript" theme="default")}
fetch('https://example.com/api/comments/23/archive', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer xxxxx'
  }
})
.then(response => {
  if (!response.ok) throw new Error("HTTP " + response.status);
  return response.json();
})
.then(data => console.log(data))
.catch(error => console.error("Fetch error:", error));

{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Response - comments" colors="json" theme="default")}
{
  "threadId": 23,
  "type": "wiki page",
  "objectId": "test-page",
  "status": "DONE",
  "do": "archive"
}
{CODE}
{DIV}

{TABS}

!!!! Parameters

* __threadId__ ''integer'' ~~#fe0000:*~~: The comment thread ID.

{DIV}

{DIV(class="content-section d-none" id="unarchive-comments")}
!!! Unarchive comment

{TABS(name="doc-unarchive-comments" tabs="Request URL| cURL | PHP | JavaScript | Response" toggle="y" inside_pretty="n")}

{DIV()}
{CODE(caption="Request URL - comments" colors="http" theme="default")}
https://example.com/api/comments/{threadId}/unarchive
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="cURL - comments" colors="http" theme="default")}
curl -X 'POST' \
  'https://example.com/api/comments/23/unarchive' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer xxxxx'
{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="PHP - comments" colors="php" theme="default")}
<?php

$url = 'https://example.com/api/comments/23/unarchive';

$headers = [
    'Accept: application/json',
    'Authorization: Bearer xxxxx'
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, '');

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error: ' . curl_error($ch);
} else {
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    if ($status === 200) {
        $data = json_decode($response, true);
        print_r($data);
    } else {
        echo "Error: HTTP status code $status\n";
        echo $response;
    }
}

curl_close($ch);
?>

{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Javascript - comments" colors="javascript" theme="default")}
fetch('https://example.com/api/comments/23/unarchive', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer xxxxx'
  }
})
.then(response => {
  if (!response.ok) throw new Error("HTTP " + response.status);
  return response.json();
})
.then(data => console.log(data))
.catch(error => console.error("Fetch error:", error));

{CODE}
{DIV}

/////
{DIV()}
{CODE(caption="Response - comments" colors="json" theme="default")}
{
  "threadId": 23,
  "type": "wiki page",
  "objectId": "test-page",
  "status": "DONE",
  "do": "unarchive"
}
{CODE}
{DIV}

{TABS}

!!!! Parameters

* __threadId__ ''integer'' ~~#fe0000:*~~: The comment thread ID.

{DIV}
Show PHP error messages