LoudVoice API \ Discussions \ Create new discussion

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 create a new discussion:

POST /loudvoice/discussions.json

POST data that must be included in the request

{
  "request": {
    "discussion": {
      "discussion_reference": "#discussion_reference#",
      "title": "#title#",
      "url": "#url#",
      "is_closed": "#is_closed#",
      "date_creation": "#date_creation#"
    }
  }
}
Key Description
Reference
discussion_reference
string
This value is used to indicate which discussion needs to be displayed when embedding LoudVoice using our JavaScript API. The value must be unique amongst your discussions. If left empty, the discussion cannot be embedded using the JavaScript API.
Example: PAGE-124
Metadata
* title
string
The title of the page where the discussion is displayed.
Example: Shop Item 27
url
string
The URL of the page where the discussion is displayed.
Example: http://www.example.com/shop/item/25/
is_closed
boolean
Indicates whether the discussion is closed or not. Defaults to false.
Closed discussion remain visible, but no more comments may be left.
Example : true
date_creation
string, RFC 2822
Date when the discussion was created. Defaults to the current date.
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 201 on success or an appropriate message body with further details on the error that occured.

Resultset Example

{
  "response": {
    "request": {
      "date": "Thu, 07 Nov 2019 16:08:36 +0100",
      "resource": "/loudvoice/discussions.json",
      "status": {
        "flag": "created",
        "code": 201,
        "info": "Your request has been processed successfully and resulted in a new resource being created"
      }
    },
    "result": {
      "data": {
        "discussion": {
          "discussion_token": "6bce047a-e0eb-48ee-abbd-58290d10f034",
          "discussion_reference": "SHOP-ITEM-127",
          "title": "Shop Item 127",
          "url": "http://www.my-example-shop/items/127/",
          "is_closed": false,
          "is_trashed": false,
          "num_comments": 0,
          "date_last_comment": null,
          "date_creation": "Mon, 14 Oct 2019 17:08:36 +0200",
          "date_last_update": null
        }
      }
    }
  }
}

User Contributed Notes