Loudvoice API \ Comments \ Update a comment
LoudVoice API Resources
Resource/URI - Discussions | GET | POST | PUT | DELETE |
---|---|---|---|---|
Discussions
/loudvoice/discussions.json
|
List all discussions | Create a discussion | – | – |
Discussion
/loudvoice/discussions/<discussion_token>.json
|
Read a discussion | – | Update a discussion | Delete a discussion |
Discussion messages
/loudvoice/comments/<discussion_token>/comments.json
|
Read discussion comments | – | – | – |
Resource/URI - Authors | GET | POST | PUT | DELETE |
---|---|---|---|---|
Authors
/loudvoice/authors.json
|
List all authors | Create an author | – | – |
Author
/loudvoice/authors/<author_token>.json
|
Read an author | – | Update an author | Delete an author |
Resource/URI - Author Sessions | GET | POST | PUT | DELETE |
---|---|---|---|---|
Author Sessions
/loudvoice/authors/sessions.json
|
List all sessions | – | Create or update a session | – |
Author Session
/loudvoice/authors/sessions/<session_token>.json
|
– | – | – | Delete a session |
Resource/URI - Comments | GET | POST | PUT | DELETE |
---|---|---|---|---|
Comments
/loudvoice/comments.json
|
List all comments | Create a comment | – | – |
Comment
/loudvoice/comments/<comment_token>.json
|
Read a comment | – | Update a comment | Delete a comment |
Resource/URI - Votes | GET | POST | PUT | DELETE |
---|---|---|---|---|
Votes
/loudvoice/votes.json
|
List all votes |
– | – | – |
Vote
/loudvoice/votes/comments/<comment_token>/authors/<author_token>.json
|
Read a vote | – | Cast a vote | Delete a vote |
Workflow
Request: the code to send to the API
Send an API request to this endpoint in order to update a comment:
PUT
/loudvoice/comments/<comment_token>.json
The <comment_token>
has to be replaced by the unique token of an existing comment.
PUT
data to include in the request
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | { "request" : { "comment" : { "comment_reference" : "#comment_reference#" , "text" : "#text#" , "ip_address" : "#ip_address#" , "date_creation" : "#date_creation#" , "has_been_approved" : #has_been_approved#, "is_spam" : #is_spam#, "is_trashed" : #is_trashed#, "votes" : { "num_votes_up" : #num_votes_up#, "num_votes_down" : #num_votes_down#, "date_last_vote" : "#date_last_vote#" } } } } |
Key | Description |
---|---|
Comment Reference | |
comment_referencestring
|
Your custom reference for this comment. This value must be unique amongst all comments of the same discussion. Example: POST-1234 |
Comment Metadata | |
* textstring
|
The comment contents. Example: Hello world! This is my first comment. |
ip_addressstring, IPv4
|
The IP address that was used to publish the comment. Example: 127.0.0.1 |
date_creationstring, RFC 2822
|
Date indicating when the comment was posted. Example: Wed, 14 Mar 2018 14:19:49 +0100 |
has_been_approvedboolean
|
Indicates whether the comment has been approved or not. The LoudVoice widget displays comments that have not been approved only to it's author. |
is_spamboolean
|
Indicates whether the comment has been flagged as spam or not. The LoudVoice widget does not display comments that have been flagged as spam. |
is_trashedboolean
|
Indicates whether the comment has been trashed or not. The LoudVoice widget does not display comments that have been trashed. |
Comment Votes | |
The number of votes is calculated automatically. Use these fields to manually offset the internal counters. | |
num_votes_upinteger
|
Number of times this comment has been voted up. Example: 42 |
num_votes_downinteger
|
Number of times this comment has been voted down. Example: 28 |
date_last_votestring, RFC 2822
|
Date of the last vote. Example: Wed, 14 Mar 2018 14:19:49 +0100 |
Result: the code returned by the API
The API will either return a HTTP status code 200
on a successful update or
an appropriate message body with further details on the error that occured.
Resultset Example
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 | { "response" : { "request" : { "date" : "Fri, 06 Apr 2017 12:28:39 0200" , "resource" : "/loudvoice/comments/e7d62bf7-5100-4e58-ba68-26fd1ad24897.json" , "status" : { "flag" : "success" , "code" : 200 , "info" : "Your request has been processed successfully" } }, "result" : { "data" : { "comment" : { "comment_token" : "e7d62bf7-5100-4e58-ba68-26fd1ad24897" , "comment_reference" : "COMMENT-3234" , "parent_comment_token" : "adbd1883-ebb2-4601-8134-29475de4c6c1" , "parent_comment_reference" : "COMMENT-3233" ,, "date_creation" : "Fri, 06 Apr 2017 12:20:40 0200" , "date_last_update" : "Fri, 06 Apr 2017 12:28:39 0200" , "post_order" : 44 , "has_been_approved" : true , "is_spam" : false , "is_trashed" : false , "ip_address" : "172.16.254.1" , "text" : "Hello World! This is my comment!" , "votes" : { "num_votes_up" : 1 , "num_votes_down" : 0 , "date_last_vote" : "Fri, 06 Apr 2017 12:28:39 0200" }, "reports" : { "num_reports" : 0 , "date_last_report" : null } } } } } } |