Comment methods

Each method represents a specific comment activity, for example getting a comment. You use each method by sending a request to the URI in a certain format. Upon successful request, the server always responds with a 200 OK status code.

In the following table, you can see details on the various methods you can use to manage comments.

Create a comment

HTTP POST request: /RestApi/comments-api/comments

Posted data JSON format:

Text
{
    "Message":"String",
    "Name":"String",
    "Email":"String",
    "CustomData":"String",
    "ThreadKey":"String",
    "Thread":{
        "Key":"String",
        "Type":"String",
        "Title":"String",
        "Language":"String",
        "DataSource":"String",
        "GroupKey":"String",
        "Group":{
            "Key":"String",
            "Name":"String",
            "Description":"String"
        }
    },  
    "Captcha":{
        "Answer":"String",
        "CorrectAnswer":"String",
        "InitializationVector":"String",
        "Key":"String"
    }
}

Details of the published comment:

Text
{
    "Key":"String",
    "Name":"String",
    "Message":"String",
    "DateCreated":"\/Date(-62135596800000-0000)\/",
    "ProfilePictureUrl":"String",
    "ProfilePictureThumbnailUrl":"String",
    "Status":"String",
    "Email":"String",
    "ThreadKey":"String",
    "AuthorIpAddress":"String",
    "CustomData":"String"
}

Get a comment

HTTP GET request: /RestApi/comments-api/comments/{key}
where key is the comment's identifier

Posted data JSON format:

Text
{
    "Key":"String"
}

Details of the requested comment:

Text
{
    "Key":"String",
    "Name":"String",
    "Message":"String",
    "DateCreated":"\/Date(-62135596800000-0000)\/",
    "ProfilePictureUrl":"String",
    "ProfilePictureThumbnailUrl":"String",
    "Status":"String",
    "Email":"String",
    "ThreadKey":"String",
    "AuthorIpAddress":"String",
    "CustomData":"String"
}

Update a comment

HTTP PUT request: /RestApi/comments-api/comments

Posted data JSON format:

Text
{
    "Key":"String",
    "Message":"String",
    "Status":"String",
    "Name":"String",
    "Email":"String",
    "CustomData":"String"
}

Details of the updated comment:

Text
{
    "Key":"String",
    "Name":"String",
    "Message":"String",
    "DateCreated":"\/Date(-62135596800000-0000)\/",
    "ProfilePictureUrl":"String",
    "ProfilePictureThumbnailUrl":"String",
    "Status":"String",
    "Email":"String",
    "ThreadKey":"String",
    "AuthorIpAddress":"String",
    "CustomData":"String"
}

Get a collection of comments

HTTP GET request: /RestApi/comments-api/comments

Posted data JSON format:

Text
{
    "ThreadKey":"String",
    "Skip":0,
    "Take":0,
    "SortDescending":false,
    "NewerThan":"\/Date(-62135596800000-0000)\/",
    "OlderThan":"\/Date(-62135596800000-0000)\/"
}

Total number of comments and content of the comments filtered by the request parameters:

Text
{
    "TotalCount":2,
    "Items":[
        {
            "Key":"String",
            "Name":"String",
            "Message":"String",
            "DateCreated":"\/Date(1389886187497)\/",
            "ProfilePictureUrl":"String",
            "ProfilePictureThumbnailUrl":"String",
            "Status":"String",
            "Email":"String",
            "ThreadKey":"String",
            "AuthorIpAddress":"String"
        },
        {
            "Key":"String",
            "Name":"String",
            "Message":"String",
            "DateCreated":"\/Date(1389886187497)\/",
            "ProfilePictureUrl":"String",
            "ProfilePictureThumbnailUrl":"String",
            "Status":"String",
            "Email":"String",
            "ThreadKey":"String",
            "AuthorIpAddress":"String"
        }
    ]
}

Get a collection of comments with extended filtering

HTTP POST request: /RestApi/comments-api/comments/filter

Posted data JSON format:

Text
{
    "CommentKey":["String"],
    "ThreadKey":["String"],
    "Language":["String"],
    "AuthorKey":["String"],
    "Status":["String"],
    "ThreadType":["String"],
    "GroupKey":["String"],
    "Skip":0,
    "Take":0,
    "SortDescending":false,
    "NewerThan":"\/Date(-62135596800000-0000)\/",
    "OlderThan":"\/Date(-62135596800000-0000)\/"
}

Total number of comments and content of the comments filtered by the request parameters:

Text
{
    "TotalCount":2,
    "Items":[
        {
            "Key":"String",
            "Name":"String",
            "Message":"String",
            "DateCreated":"\/Date(1389886187497)\/",
            "ProfilePictureUrl":"String",
            "ProfilePictureThumbnailUrl":"String",
            "Status":"String",
            "Email":"String",
            "ThreadKey":"String",
            "AuthorIpAddress":"String"
        },
        {
            "Key":"String",
            "Name":"String",
            "Message":"String",
            "DateCreated":"\/Date(1389886187497)\/",
            "ProfilePictureUrl":"String",
            "ProfilePictureThumbnailUrl":"String",
            "Status":"String",
            "Email":"String",
            "ThreadKey":"String",
            "AuthorIpAddress":"String"
        }
    ]
}

Get the count of comments in a thread

HTTP GET request: /RestApi/comments-api/comments/count

Posted data JSON format:

Text
{
    "ThreadKey":["String"],
    "Status":["String"]
}

Number of comments:

Text
{
    "Key":"String",
    "Count":"String"
}

Batch-update the status of a collection of comments

HTTP PUT request: /RestApi/comments-api/comments/list

Posted data JSON format:

Text
{
    "Key":["String"],
    "Status":"String"
}

Total number of comments and content of updated comments:

Text
{
    "TotalCount":2,
    "Items":[
        {
            "Key":"String",
            "Name":"String",
            "Message":"String",
            "DateCreated":"\/Date(1389886187497)\/",
            "ProfilePictureUrl":"String",
            "ProfilePictureThumbnailUrl":"String",
            "Status":"String",
            "Email":"String",
            "ThreadKey":"String",
            "AuthorIpAddress":"String"
        },
        {
            "Key":"String",
            "Name":"String",
            "Message":"String",
            "DateCreated":"\/Date(1389886187497)\/",
            "ProfilePictureUrl":"String",
            "ProfilePictureThumbnailUrl":"String",
            "Status":"String",
            "Email":"String",
            "ThreadKey":"String",
            "AuthorIpAddress":"String"
        }
    ]
}

Delete a comment

HTTP DELETE request: /RestApi/comments-api/comments/{key}
where key is the comment's identifier

Posted data JSON format:

Text
{
    "Key":"String"
}

The comment is deleted.

Batch-delete a collection of comments 

HTTP DELETE request: /RestApi/comments-api/comments/list

Posted data JSON format:

Text
{
    "Key":"String"
}

The comments are deleted.

Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.