(Quick Reference)

Comment

addComment

  • Path : /api/comment/addComment
  • Parameters :
    • commentBody : comment text
    • commentHolderId :Id of object holding comment
    • commentHolderType : Type of object holding comment
    • rootHolderId : Id of root object holding comment
    • rootHolderType : Type of root object holding comment
    • parentId : Id of parent comment in case of reply
    • mainParentId: Id of main comment in case of discussion thread
    • subject: subject
    • newerTimeRef : current time in milliseconds
  • REST method : POST
  • Permissions : logged in user. needs X-Auth-Token header
  • Request :

http://indiabiodiversity.localhost.org/api/comment/addComment?commentHolderId=268292&rootHolderId=268292&rootHolderType=species.participation.Observation&commentHolderType=species.participation.Observation&newerTimeRef=1403071938526&commentBody=test comment
For example
commentBody:test comment
commentHolderId:268292
commentHolderType:species.participation.Observation
rootHolderId:268292
rootHolderType:species.participation.Observation
parentId:
mainParentId:
subject:test subject
newerTimeRef:1403071938526
  • Response :
    • Successful response :

{
    "success": true,
    "newerTimeRef": "1403072802813",
    "newlyAddedCommentCount": 4,
    "commentList": [
        {
            "id": 12383,
            "text": "test comment 1",
            "authorId": 1188,
            "lastUpdated": "2014-06-18T06:26:42Z",
            "commentHolderType": "species.participation.Observation"
        },
        {
            "id": 12382,
            "text": "test comment",
            "authorId": 1188,
            "lastUpdated": "2014-06-18T06:26:04Z",
            "commentHolderType": "species.participation.Observation"
        },
        {
            "id": 12381,
            "text": "tc2",
            "authorId": 1188,
            "lastUpdated": "2014-06-18T06:25:52Z",
            "commentHolderType": "species.participation.Observation"
        },
        {
            "id": 12380,
            "text": "tc1",
            "authorId": 1188,
            "lastUpdated": "2014-06-18T06:25:42Z",
            "commentHolderType": "species.participation.Observation"
        }
    ],
    "clearForm": true
}
    • in case of error :

{
    "success": false,
     "msg": "Error in saving"
}

removeComment

  • Path : /api/comment/removeComment
  • Parameters :
    • commentId : Id of comment object
  • REST method : GET
  • Permissions : logged in user. needs X-Auth-Token header
  • Request :

http://indiabiodiversity.localhost.org/api/comment/removeComment?commentId=12375
For example
commentId:12375
  • Response :
    • Successful response :

{
    "success": true
}
    • in case of error :

{
    "success": false
}

getComments

  • Path : /api/comment/getComments
  • Parameters :
    • commentHolderId :Id of object holding comment
    • commentHolderType : Type of object holding comment
    • rootHolderId : Id of root object holding comment
    • rootHolderType : Type of root object holding comment
    • max : max number of comment to fetch
    • refTime : reference time offset
    • timeLine : older or newer
  • REST method : GET
  • Request :

http://indiabiodiversity.localhost.org/api/comment/getComments?commentHolderId=268292&rootHolderId=268292&rootHolderType=species.participation.Observation&commentHolderType=species.participation.Observation&refTime=1403071938526&max=3&timeLine=older
For example
commentHolderId:268292
commentHolderType:species.participation.Observation
rootHolderId:268292
rootHolderType:species.participation.Observation
parentId:
max:3
refTime:1403071938526
timeLine:older
  • Response :

{
{
    "olderTimeRef": "1359906933122",
    "remainingCommentCount": 0,
    "commentList": [
        {
            "id": 1392,
            "text": "Combining common and Sc names",
            "authorId": 1426,
            "lastUpdated": "2013-02-03T15:55:33Z",
            "commentHolderType": "species.participation.Recommendation"
        }
    ]
}