Add Comment

Add a comment to a record in an App.

MethodPOST
URLhttps://{subdomain}.kintone.com/k/v1/record/comment.json
URL(guest space)https://{subdomain}.kintone.com/k/guest/{SpaceID}/v1/record/comment.json
Authentication Password Authentication , API Token Authentication , Session Authentication
Content-Typeapplication/json

Contents

Permissions

The user or API Token must have permission to view the record to add a comment.

Request Parameters

Parameter Type Required Description
app Integer or String Yes The App ID.
record Integer or String Yes The Record ID.
comment Object Yes An object including comment details.
comment.text String Yes The comment text.
The maximum length is 65,535 characters.
comment.mentions Array of Objects Optional An array including information to mention other users.
comment.mentions[].code String Optional The code of the user, group or organization that will be mentioned.
The maximum number of mentions is 10.
Mentioned users will be displayed at the start of the comment text when the API succeeds.
When specifying a guest user as the recipient, the code parameter must include the prefix guest/ followed by the login email address.
comment.mentions[].type String Optional The type of the mentioned target.
  • USER: User
  • GROUP: Group
  • ORGANIZATION: Department

Sample Request

JavaScript using kintone.api()

 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
var body = {
  'app': 1,
  'record': 1,
  'comment': {
    'text': 'sample comment',
    'mentions': [
      {
        'code': 'Administrator',
        'type': 'USER'
      },
      {
        'code': 'guest/guest@test.com',
        'type': 'USER'
      }
    ],
  }
};

kintone.api(kintone.api.url('/k/v1/record/comment.json', true), 'POST', 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
12
13
14
15
16
17
18
19
20
curl -X POST 'https://{subdomain}.kintone.com/k/v1/record/comment.json' \
  -H 'X-Cybozu-API-Token: L08xCvTh7A1EVm3rZimF98R8VLP3k4lMlzELqyCx' \
  -H 'Content-Type: application/json' \
  -d '{
    "app": 1,
    "record": 1,
    "comment": {
      "text": "sample comment",
      "mentions": [
        {
          "code": "Administrator",
          "code": "USER"
        },
        {
          "code": "guest/guest@test.com",
          "code": "USER"
        }
      ]
    }
  }'

Response Parameters

Parameter Type Description
id String The Comment ID.

Sample Response

Body

The ID of the added comment will be returned.

1
2
3
{
  "id": "4"
}

Sample comment added by API Token.

Limitations

  • If an API Token is used to post a comment, the comment will be posted by the Administrator user.
  • If the mentioned name has a localized name setting, and the language of the localized name is the same as the comment poster's language settings, the mentioned name will be posted as the localized name.
  • Inactive/deleted users, departments, and groups cannot be mentioned.
  • An error will return if the commenting feature of the App is turned off.
  • For other limitations, refer to the following article:
    Kintone REST API Overview