Posts


Request all posts

/api/posts/
You'll get paginated data with following structure:

{
    "count": 160,
    "next": "http://127.0.0.1:8000/api/posts/?page=2",
    "previous": null,
    "results": [
        {
            "id": 1,
            "html_message": "<p>Does field</p> <code>html_message</code> changes according to the <code>message</code>?</p>",
            "message": "Does field `html_message` changes according to the `markdown_message`?",
            "created_by": {
                "id": 1,
                "username": "automan",
                "detail_url": "http://127.0.0.1:8000/api/users/1/"
            },
            "created_at": "09.03.2018, 08:38",
            "edit_post_url": "http://127.0.0.1:8000/api/posts/1/edit/",
            "topic": {
                "id": 1,
                "title": "subject",
                "starter": {
                    "id": 1,
                    "username": "automan",
                    "detail_url": "http://127.0.0.1:8000/api/users/1/"
                },
                "views": 0,
                "last_updated": "09.03.2018, 08:38",
                "posts_url": "http://127.0.0.1:8000/api/topics/1/posts/",
                "reply_topic": "http://127.0.0.1:8000/api/topics/1/reply/"
            }
        },
        ...
    ]
}

Request specific post by given id

/api/posts/id/
You'll get data with structure as in list above.


Edit post by given id

/api/posts/id/edit/
You have to be owner of post to be able to edit it. By sending GET request you'll receive data in structure as mentioned above. To create a post you need to send data with attribute "message" inside. In message text you can use markdown rules. If everything right you'll receive created post.