Get Comments

Retrieves multiple comments from a record in an app.

MethodGET
URLhttps://{subdomain}.kintone.com/k/v1/record/comments.json
URL(guest space)https://{subdomain}.kintone.com/k/guest/{SpaceID}/v1/record/comments.json
Authentication Password Authentication , API Token Authentication , Session Authentication
Content-Typeapplication/json (not needed if specifying the query with a query string)

Contents

Permissions

The user or API Token must have permission to view the record to retrieve comments.

Request Parameters

PARAMETER VALUE REQUIRED DESCRIPTION
app Integer or String Yes The App ID.
record Integer or String Yes The Record ID.
order String Optional The sort order of the Comment ID. Specifying "asc" will sort the comments in ascending order, and "desc" will sort the comments in descending order.
If ignored, "desc" will be set.
offset Integer Optional This skips the retrieval of the first number of comments.
"offset": 30 skips the first 30 comments, and retrieves from the 31st comment. There is no maximum for this value.
limit Integer Optional The number of records to retrieve.
"limit": 5 will retrieve the first 5 comments. The default and maximum is 10 comments.

Sample Request (Query String)

1
2
3
4
5
6
7
8
9
var query = '?app=1&record=1&order=asc&offset=0&limit=10';

kintone.api(kintone.api.url('/k/v1/record/comments.json', true) + query, 'GET', {}, function(resp) {
  // success
  console.log(resp);
}, function(error) {
  // error
  console.log(error);
});

curl Sample

1
2
curl -X GET 'https://{subdomain}.kintone.com/k/v1/record/comments.json?app=1&record=1&order=desc&offset=0&Limit=10' \
-H 'X-Cybozu-API-Token: L08xCvTh7A1EVm3rZimF98R8VLP3k4lMlzELqyCx'

Sample Request (JSON)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
var body = {
  'app': 1,
  'record': 1,
  'order': 'asc',
  'offset': 0,
  'limit': 10
};

kintone.api(kintone.api.url('/k/v1/record/comments.json', true), 'GET', body, function(resp) {
  // success
  console.log(resp);
}, function(error) {
  // error
  console.log(error);
});

curl Sample

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11

curl -X GET 'https://{subdomain}.kintone.com/k/v1/record/comments.json' \
-H 'X-Cybozu-API-Token: L08xCvTh7A1EVm3rZimF98R8VLP3k4lMlzELqyCx' \
-H 'Content-Type: application/json' \
-d '{
  "app": 1,
  "record": 1,
  "order": "desc",
  "offset": 0,
  "limit": 10
}'

Response Parameters

PARAMETER VALUE DESCRIPTION
comments Array of Objects An array of comments. An empty array is returned if no conditions are met.
comments[].id Integer The Comment ID.
comments[].text String The comment including the line feed codes.
If a user is mentioned within a comment, the "@" symbol will be omitted from the String.
comments[].createdAt String The created date and time of the comment.
comments[].creator Object An object including information of the comment creator.
comments[].creator.code String The comment creator's user code (log in name).
comments[].creator.name String The comment creator's user name (display name).
comments[].mentions Array An array including information of mentioned users.
comments[].mentions[].code String The code of the mentioned user, group or organization.
comments[].mentions[].type String The type of the mention.
  • USER: User
  • GROUP: Group
  • ORGANIZATION: Department
older Boolean Information of older comments:
  • true: Older comments exist.
  • false: Older comments do not exist (i.e. the first comment)
newer Boolean Information of newer comments:
  • true: Newer comments exist.
  • false: Newer comments do not exist. (i.e. the last comment)

Sample Response

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
  "comments": [
    {
      "id": "3",
      "text": "user14 Thank you! Looks great.",
      "createdAt": "2016-05-09T18:29:05Z",
      "creator": {
        "code": "user13",
        "name": "user13"
      },
      "mentions": [
        {
          "code": "user14",
          "type": "USER"
        }
      ]
    },
    {
      "id": "2",
      "text": "user13 Global Sales APAC Taskforce \nHere is today's report.",
      "createdAt": "2016-05-09T18:27:54Z",
      "creator": {
        "code": "user14",
        "name": "user14"
      },
      "mentions": [
        {
          "code": "user13",
          "type": "USER"
        },
        {
          "code": "Global Sales_1BNZeQ",
          "type": "ORGANIZATION"
        },
        {
          "code": "APAC Taskforce_DJrvzu",
          "type": "GROUP"
        }
      ]
    }
  ],
  "older": false,
  "newer": false
}

Limitations

  • The maximum number of records that can be retrieved with the Get Comments API is 10.
  • An error will return if the commenting feature of the App is turned off.
  • For other limitations, refer to the Limitations section in the following article:
    Kintone REST API Overview