Comments

Get Single Comment

curl "https://example.ziik.io/api/comments/1241"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"

The above command returns JSON structured like this:

  {
    "id":1241,
    "author":{
        "id":234,
        "name":"Test User",
        "avatar":{
            "id":"345",
            "name":"avatar.png",
            "mime":"image/png",
            "size":"54314",
            "type":"image",
            "source":"https://example.ziik.io/api/file/default_images/avatar.png",
            "versions":{
                "listing":"https://example.ziik.io/api/file/styles/article_listing/private/default_images/avatar.png",
                "detail":"https://example.ziik.io/api/file/styles/article_desktop/private/default_images/avatar.png",
                "thumbnail":"https://example.ziik.io/api/file/styles/media_thumbnail/private/default_images/avatar.png"
            }
        },
        "userType":{
            "id":11,
            "name":"Worker",
            "url":"api/user_types/11"
        },
        "url":"api/users/234"
    },
    "body": "This is a comment",
    "files": [{
        "id":"345",
        "name":"filename.png",
        "mime":"image/png",
        "size":"54314",
        "type":"image",
        "source":"https://example.ziik.io/api/file/groups/avatar.png",
        "versions":{
            "listing":"https://example.ziik.io/api/file/styles/article_listing/private/default_images/avatar.png",
            "detail":"https://example.ziik.io/api/file/styles/article_desktop/private/default_images/avatar.png",
            "thumbnail":"https://example.ziik.io/api/file/styles/media_thumbnail/private/default_images/avatar.png"
        }
    }],
    "date":1465910290,
    "latest_reply": {
        "Nested comment..."
    },
    "url":"api/comments/1241"
  }

This endpoint returns a single comment with its latest reply, if applicable

HTTP Request

GET https://example.ziik.io/api/comments/ID

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the comment

Permissions Required

  • Access to commented content

Edit a Comment

curl -i -X PATCH "https://example.ziik.io/api/comments/1241"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 204 No Content on successful comment update.

HTTP/1.0 204 No Content

This endpoint updates an existing comment.

HTTP Request

PATCH https://example.ziik.io/api/comments/ID

Request Parameters

ParameterTypeRequiredDescription
commentStringYesComment body.

Permissions Required

  • Group administrator of commented debate
  • OR Comment author

TIP

Authors can only edit or delete comments within 15 minutes of creation.

Delete a Comment

curl -i -X DELETE "https://example.ziik.io/api/comments/124"
  -H "Authorization: Bearer aaaaaa.bbbbbbb.ccccccc"

The above command returns a 204 No Content header on success:

HTTP/1.0 204 No Content

This endpoint deletes a comment.

HTTP Request

DELETE https://example.ziik.io/api/comments/ID

URL Parameters

ParameterTypeDescription
idIntegerThe ID of the comment to delete

Permissions Required

  • Group administrator of commented debate
  • OR Comment author

TIP

Authors can only edit or delete comments within 15 minutes of creation.

Get Comment Likers

curl "https://example.ziik.io/api/comments/123/likes"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"

The above command returns JSON structured like this:

  [{
    "timestamp": 1465823551,
    "user": { "See User Service..." }
  },
  {
    "timestamp": 1465823556,
    "user": { "See User Service..." }
  }]

This endpoint returns a list of users, who have liked a comment along with the timestamp of the like.

HTTP Request

GET https://example.ziik.io/api/comments/ID/like

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the comment

Permissions Required

  • Access to the comment's content

Like comment

curl -i -X POST "https://example.ziik.io/api/comments/123/like"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 204 No Content on success

HTTP/1.0 204 No Content

This endpoint marks a comment as liked by the user.

HTTP Request

POST https://example.ziik.io/api/comments/123/like

Request Parameters

None

Permissions Required

  • Read access to the comment's content

Unlike a Comment

curl -i -X DELETE "https://example.ziik.io/api/comments/123/like"
  -H "Authorization: Bearer aaaaaa.bbbbbbb.ccccccc"

The above command returns a 204 No Content header on success:

HTTP/1.0 204 No Content

This endpoint removes a like for a comment for the current user.

HTTP Request

DELETE https://example.ziik.io/api/comments/IDlike

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the comment to unlike

Add Files To Comment

curl -i -X POST "https://example.ziik.io/api/comments/files"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 204 No Content on success

HTTP/1.0 204 No Content

This endpoint adds files to an existing comment.

HTTP Request

POST https://example.ziik.io/api/comments/files

Request Parameters

ParameterTypeDescription
idIntegerThe ID of the comment to add files to
filesArrayNo
- typeStringYes
- nameStringYes
- dataStringYes

Permissions Required

  • Group administrator
  • OR Comment author

TIP

Authors can only add files to comments within 15 minutes of creation.

Delete File From Comment

curl -i -X DELETE "https://example.ziik.io/api/comments/124/files/12345"
  -H "Authorization: Bearer aaaaaa.bbbbbbb.ccccccc"

The above command returns a 204 No Content header on success:

HTTP/1.0 204 No Content

This endpoint deletes a file from a comment.

HTTP Request

DELETE https://example.ziik.io/api/comments/<CommentID>/files/<FileID>

URL Parameters

ParameterTypeDescription
CommentIDIntegerThe ID of the comment
FileIDIntegerThe ID of the file to delete

Permissions Required

  • Edit permission to comment content
  • OR Comment author

TIP

Authors can only remove files from comments within 15 minutes of creation.

Reply To A Comment

curl -i -X POST "https://example.ziik.io/api/comments/124/reply"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"
  -d "{ [...] }"

The above command returns 201 Created with a location header for where to find the new comment

HTTP/1.0 201 Created
Location: https://example.ziik.io/api/comments/1234
{
    "message": "Comment created"
}

This endpoint creates a new reply to a comment. A reply is simply another comment with the first comment as its parent

HTTP Request

POST https://example.ziik.io/api/comments/ID/reply

Request Parameters

ParameterTypeRequiredDescription
commentStringYesComment body.
fileCountIntegerNoNumber of files that will be uploaded (type 'upload') in total, including subsequent POSTs to /api/comments/ID/files
filesArrayNoFile data for files to accompany the debate. If provided, existing files are cleared. Must be an array of arrays with the following values
- typeStringYesType of file - can be either 'upload', 'youtube' or 'vimeo'.
- nameStringYesFile name.
- dataStringYesIf type is 'upload' this must be the base64 encoded content of the file. Else it must be the Youtube/Vimeo embed URL.

Permissions Required

  • Access permission to comment's content
  • Comments enabled for content

Get Replies to a Comment

curl "https://example.ziik.io/api/comments/124/replies"
  -H "Authorization: Bearer aaaaaaaaa.bbbbbbbbb.cccccccccc"

The above command returns JSON structured like this:

  [{
      "id":1241,
      "author":{
          "id":234,
          "name":"Test User",
          "avatar":{
              "id":"345",
              "name":"avatar.png",
              "mime":"image/png",
              "size":"54314",
              "type":"image",
              "source":"https://example.ziik.io/api/file/default_images/avatar.png",
              "versions":{
                  "listing":"https://example.ziik.io/api/file/styles/article_listing/private/default_images/avatar.png",
                  "detail":"https://example.ziik.io/api/file/styles/article_desktop/private/default_images/avatar.png",
                  "thumbnail":"https://example.ziik.io/api/file/styles/media_thumbnail/private/default_images/avatar.png"
              }
          },
          "userType":{
              "id":11,
              "name":"Worker",
              "url":"api/user_types/11"
          },
          "url":"api/users/234"
      },
      "body": "This is a comment",
      "files": [{
          "id":"345",
          "name":"filename.png",
          "mime":"image/png",
          "size":"54314",
          "type":"image",
          "source":"https://example.ziik.io/api/file/groups/avatar.png",
          "versions":{
              "listing":"https://example.ziik.io/api/file/styles/article_listing/private/default_images/avatar.png",
              "detail":"https://example.ziik.io/api/file/styles/article_desktop/private/default_images/avatar.png",
              "thumbnail":"https://example.ziik.io/api/file/styles/media_thumbnail/private/default_images/avatar.png"
          }
      }],
      "date":1465910290,
      "url":"api/comments/1241"
    },
    {
      "id":1242,
      "author":{
          "id":234,
          "name":"Test User",
          "avatar":{
              "id":"345",
              "name":"avatar.png",
              "mime":"image/png",
              "size":"54314",
              "type":"image",
              "source":"https://example.ziik.io/api/file/default_images/avatar.png",
              "versions":{
                  "listing":"https://example.ziik.io/api/file/styles/article_listing/private/default_images/avatar.png",
                  "detail":"https://example.ziik.io/api/file/styles/article_desktop/private/default_images/avatar.png",
                  "thumbnail":"https://example.ziik.io/api/file/styles/media_thumbnail/private/default_images/avatar.png"
              }
          },
          "userType":{
              "id":11,
              "name":"Worker",
              "url":"api/user_types/11"
          },
          "url":"api/users/234"
      },
      "body": "This is another comment",
      "files": [{
          "id":"345",
          "name":"filename.png",
          "mime":"image/png",
          "size":"54314",
          "type":"image",
          "source":"https://example.ziik.io/api/file/groups/avatar.png",
          "versions":{
              "listing":"https://example.ziik.io/api/file/styles/article_listing/private/default_images/avatar.png",
              "detail":"https://example.ziik.io/api/file/styles/article_desktop/private/default_images/avatar.png",
              "thumbnail":"https://example.ziik.io/api/file/styles/media_thumbnail/private/default_images/avatar.png"
          }
      }],
      "date":1465910290,
      "url":"api/comments/1242"
    }]

This endpoint returns all replies for a comment

HTTP Request

GET https://example.ziik.io/api/comments/ID/replies

URL Parameters

ParameterTypeDescription
IDIntegerThe ID of the debate

Permissions Required

  • Access permission to comment content