Zum Hauptinhalt springen

Documentation

IMPORTANT

This is the outdated SI-documentation which will be adapted soon. A huge part may be obsolete!

Creating New Post

Creating New Post

In this section, we will briefly explain the REST API to Creating New Post.

This REST API call allows requester to create a new post to 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=submit&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.
  • title (required)
    This title parameter is the title for your post.
  • content (required)
    This content parameter is the content for your post.
  • category_id (required)
    This category_id parameter is the category in which this post will be posted into.

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": {
    "id": "30",
    "permalink": "http://easydiscuss.com/index.php?option=com_easydiscuss&view=post&id=30&Itemid=118&format=json",
    "title": "test rest api",
    "user_id": "961",
    "hits": "0",
    "vote": "0",
    "state": "4",
    "locked": "0",
    "created": "2016-04-20 09:41:43",
    "modified": "2016-04-20 09:41:43",
    "content": "<h3>This is a test for rest api</h3>. If the post is created then this rest api is working correctly.",
    "preview": "&lt;h3&gt;This is a test for rest api&lt;/h3&gt;. If the post is created then this rest api is working correctly.",
    "replies": [],
    "comments": []
  },
  "message": "Your discussion is created successfully."
}

And a fail request response will looks similar as below:

{
  "code": 404,
  "message": "Invalid username or password"
}
Wir benutzen Cookies
Wir nutzen Cookies auf unserer Website. Einige von ihnen sind essenziell für den Betrieb der Seite, während andere uns helfen, diese Website und die Nutzererfahrung zu verbessern. Du kannst selbst enscheiden, ob du Cookies zulassen möchtest. Bitte beachte, dass bei Ablehnung womöglich nicht mehr alle Funktionalitäten zur Verfügung stehen.