box-apiboxapiv2

How do I get the comments added to a comment in the in the Box REST API?


How do I get the comments added to a comment in the in the Box REST API?

For example, how would I return the comments (marked in red) for the comment (marked in black)?

enter image description here


Solution

  • They should be included in the list comments on a file. The only difference is that the reply comments will have their is_reply_comment field set to true.

    Note that the ordering of the returned comments is important. Since replies can only be one level deep, a reply comment is always associated with the first non-reply comment above it.

    Here's a sample response including a comment and a reply to the first comment:

    GET https://api.box.com/2.0/files/28785720644/comments
    
    {
      "total_count": 2,
      "offset": 0,
      "limit": 100,
      "entries": [
        {
          "type": "comment",
          "id": "63003535",
          "is_reply_comment": false,
          "message": "First message",
          "created_by": {
            "type": "user",
            "id": "221860571",
            "name": "Name",
            "login": "login@gmail.com"
          },
          "created_at": "2015-04-14T17:49:07-07:00"
        },
        {
          "type": "comment",
          "id": "63003537",
          "is_reply_comment": true,
          "message": "Reply message",
          "created_by": {
            "type": "user",
            "id": "221860571",
            "name": "Name",
            "login": "login@gmail.com"
          },
          "created_at": "2015-04-14T17:49:07-07:00"
        }
      ]
    }