Rest Api

EasyDiscuss 4 includes a simple REST api that allows you to connect to EasyDiscuss to perform various tasks.

Replying A Post

In this section, we will briefly explain the REST API to Replying A Post.

This REST API call allows requester to reply a post created on the site. To do so, requester need to send a POST request to this following url:

http://site.com/index.php?option=com_easydiscuss&view=post&layout=reply&format=json&tmpl=component

POST Parameters

The following are the available parameters when a POST is made to this API call:

  • auth (required)
    This auth parameter is the authorization auth token.
  • userId (required)
    This userId parameter is the user id received with the authorization auth token.
  • parent_id (required)
    This parent_id parameter is the post id.
  • content (required)
    This content parameter is the reply content.

Response

Upon a successful request, EasyDiscuss system will return a response in a form of JSON to the requester.

The successful request response will looks similar as below:

{
  "code": 200,
  "data": {
    "post": {
      "id": "25",
      "permalink": "http://easydiscuss.com/index.php?option=com_easydiscuss&view=post&id=25&Itemid=118&format=json",
      "title": "Unable to select tag for multi tag menu item",
      "user_id": "959",
      "hits": "5",
      "vote": "0",
      "state": "1",
      "locked": "0",
      "created": "2016-04-18 08:48:35",
      "modified": "2016-04-19 04:45:01",
      "content": "Unable to select tag for multi tag menu item",
      "preview": "Unable to select tag for multi tag menu item",
      "replies": [
        {
          "id": "35",
          "permalink": "http://easydiscuss.com/index.php?option=com_easydiscuss&view=post&id=25&Itemid=118#reply-35&format=json",
          "title": null,
          "user_id": "960",
          "hits": "0",
          "vote": "0",
          "state": "1",
          "locked": "0",
          "created": "2016-04-22 07:38:00",
          "modified": "2016-04-22 07:38:00",
          "content": "testrest",
          "preview": "testrest",
          "replies": [],
          "comments": []
        }
      ],
      "comments": []
    },
    "reply": {
      "id": 35,
      "permalink": "http://easydiscuss.com/index.php?option=com_easydiscuss&view=post&id=25&Itemid=118#reply-35&format=json",
      "title": "Unable to select tag for multi tag menu item",
      "user_id": "960",
      "hits": null,
      "vote": null,
      "state": 1,
      "locked": null,
      "created": "2016-04-22 07:38:00",
      "modified": "2016-04-22 07:38:00",
      "content": "testrest",
      "preview": "testrest",
      "replies": [],
      "comments": []
    }
  },
  "message": "Your reply is posted successfully."
}

And a fail request response will looks similar as below:

{
  "code": 404,
  "message": "Invalid username or password"
}