Loudvoice API \ Comments \ Update a comment

Resource/URI - Discussions GET POST PUT DELETE
Discussions /loudvoice/discussions.json List all discussions Create a discussion
Discussion /loudvoice/discussions/<discussion_token>.json /loudvoice/discussions/discussion.json?
discussion_reference=<discussion_reference>
Read a discussion Update a discussion Delete a discussion
Discussion messages /loudvoice/comments/<discussion_token>/comments.json /loudvoice/discussions/discussion/comments.json?
discussion_reference=<discussion_reference>
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 /loudvoice/authors/author.json?
author_reference=<author_reference>
Read an author Update an author Delete an author
Resource/URI - Author Sessions GET POST PUT DELETE
Author Sessions /loudvoice/authors/sessions.json Create/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

Workflow

Request: the code to send to the API

Send a PUT request with the data below to the endpoint /loudvoice/comments/<comment_token>.json to update an existing comment.

Only the fields specified in the request are updated, the other fields remain unchanged.

PUT data to include in the request

{
    "request":{
        "comment":{
            "comment_reference": "#comment_reference#", 
            "text": "#text#",
            "ip_address": "#ip_address#",
            "has_been_approved": #has_been_approved#,
            "is_spam": #is_spam#,
            "is_trashed": #is_trashed#,
        }
    }
}
Key Description
Reference
comment_reference
string
Your custom reference for this comment.
This value is unique amongst all comments of the same discussion.
Example: POST-1234
Comment Metadata
* text
string
The comment contents.
Example: Hello world! This is my first comment.
ip_address
string, IPv4
The IP address that was used to publish the comment.
Example: 127.0.0.1
has_been_approved
boolean
Indicates whether the comment has been approved or not. The LoudVoice widget displays comments that have not been approved only to it's author.
Default: true
is_spam
boolean
Indicates whether the comment has been flagged as spam or not. The LoudVoice widget does not display comments that have been flagged as spam.
Default: false
is_trashed
boolean
Indicates whether the comment has been trashed or not. The LoudVoice widget does not display comments that have been trashed.
Default: false

Result: the code returned by the API

The API will either return a HTTP status code 200 on a successful update or 201 on a successful creation. On error, an appropriate message body with further details will be returned.

Resultset Example

{
  "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": null,
            "parent_comment_token": null,
            "parent_comment_reference": null,
            "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": false,
            "is_spam": false,
            "is_trashed": false,
            "ip_address": "127.0.0.11",
            "text": "Hello World! This is my comment!",
            "votes": {
              "num_votes_up": 0,
              "num_votes_down": 0,
              "date_last_vote": null
            },
            "reports": {
              "num_reports": 0,
              "date_last_report": null
            },
            "author": {
              "author_token": "71e944f8-394e-4808-9c00-163928c59ba8",
              "author_reference": null,
              "name": "John Smith",
              "email": "john.smith@example.com",
              "description": null,
              "picture_url": "https://www.example.com/john-smith/avatar.jpg",
              "website_url":null,
              "num_comments": 18,
              "date_last_comment": "Fri, 06 Apr 2017 12:20:41  0200",
              "date_creation": "Tue, 27 Mar 2017 11:19:52  0200",
              "date_last_update": "Fri, 06 Apr 2017 12:20:41  0200"
            },
            "discussion": {
              "discussion_token": "b0ad71f8-0323-486c-916f-0c3f767f6174",
              "discussion_reference": "/api/resources/loudvoice/author/session/",
              "date_creation": "Tue, 27 Mar 2017 10:58:21  0200",
              "title": "Loudvoice Documentation",
              "url": "https://docs.oneall.com/",
              "is_closed": false,
              "is_trashed": false,
              "num_comments": 44,
              "date_last_comment": "Fri, 06 Apr 2017 12:20:41  0200",
              "date_last_update": "Tue, 27 Mar 2017 10:58:24  0200"
            }
         }
      }
    }
  }
}
    

User Contributed Notes