User moderated open commenting system
For pre-populating and/or testing, run the REST URLs provided in test_URLs.txt.
- Clicking on the link of a topic will take you to that link.
- Clicking on the topic title will show all replies to that topic
- Clicking on "add reply" will allow you to add a reply to the parent
- You can submit new topics through the form at the bottom
The system uses an Object to store a sequence of topics. Each topic is the root of a tree-like structure. The children and subsequent branches are replies.
Topics | All topics are stored in an object |
Topic | Topic is an object under topics with attributes: "id", "text", "link", "weight", "replies" |
Replies | All replies to a topic are stored in an object |
Reply | Reply is an object under replies with attributes: "id", "text", "votes", "weight", "replies", "children_ids" |
Path | /topic/all |
HTTP Method | GET |
None
JSON of all topics and replies.
JSON format | |
---|---|
Topic | { "id": topic_id, "text": text, "link": link, "weight": 0, "replies": {} } |
Reply | { "id": reply_id, "text": text, "votes": 0, "weight": 0, "replies": {}, "children_ids": [] } |
Request | $.get('http://127.0.0.1:30925/topic/all') |
Response | {"0":{"id":0,"text":"Cool search engine","link":"http://google.com","weight":0, |
"replies":{"1":{"id":1,"text":"just a reply","votes":0,"weight":0,"replies":{},"children_ids":[]}}}} |
Path | /topic/add |
HTTP Method | POST |
text | 140 character maximum text |
link | URL |
Format: /topic/add?text=yourtext&link=yourlink
JSON of topic added.
JSON format | |
---|---|
Topic | { "id": topic_id, "text": text, "link": link, "weight": 0, "replies": {} } |
Request | $.post('http://127.0.0.1:30925/topic/add?text=yourtext&link=yourlink') |
Response | {"id":3,"text":"yourtext","link":"yourlink","weight":0,"replies":{}} |
Path | /topic/reply/all |
HTTP Method | GET |
topicid | Valid existing topic ID |
Format: /topic/reply/all?topicid=XX
JSON of all replies for specified topic.
JSON format | |
---|---|
Reply | { "id": reply_id, "text": text, "votes": 0, "weight": 0, "replies": {}, "children_ids": [] } |
Request | $.get('http://127.0.0.1:30925/topic/reply/all?topicid=0') |
Response | {"1":{"id":1,"text":"just a reply","votes":0,"weight":0,"replies":{},"children_ids":[]}} |
Path | /topic/reply/add |
HTTP Method | POST |
topicid | Valid existing topic ID |
parentid (optional) | ID of reply this is in response to (ie. parent reply). Not needed for direct reply to topic. |
text | Reply content |
Format: /topic/reply/add?topicid=XX&parentid=YY&text=ZZ
JSON of all reply added.
JSON format | |
---|---|
Reply | { "id": reply_id, "text": text, "votes": 0, "weight": 0, "replies": {}, "children_ids": [] } |
Request | $.post('http://127.0.0.1:30925/topic/reply/add?topicid=0&text=yourreplytext') |
Response | {"id":4,"text":"yourreplytext","votes":0,"weight":0,"replies":{},"children_ids":[]} |
Path | /topic/reply/upvote |
HTTP Method | POST |
replyid | ID of reply for which the vote is being registered |
Format: /topic/reply/upvote?replyid=YY
Plain text: success
JSON format | |
---|---|
Reply | { "id": reply_id, "text": text, "votes": 0, "weight": 0, "replies": {}, "children_ids": [] } |
Request | $.post('http://127.0.0.1:30925/topic/reply/upvote?topicid=0&replyid=4') |
Response | success |