-
Notifications
You must be signed in to change notification settings - Fork 3
#Catalog ###Questions GET question list
###Answers
POST remove answer ###Comments POST create comment
###GET question list
-
URL:
localhost:8080/questions/list
-
response example:
[
{
"_id": "5525dfd27f133388032298e0",
"title": "what's html5",
"description": "what's new of html5?",
"tags": [
"javascript",
"html"
]
}
]
###GET single question
-
URL:
localhost:8080/questions?id=5510b357fc789da15cd2cf1f
-
response example:
{
"_id": "5525dfd27f133388032298e0",
"title": "what's html5",
"description": "what's new of html5?",
"tags": [
"javascript",
"html"
],
"answers": [
{
"_id": "5525dfef7f133388032298e1",
"description": "I hava no idea!"
}
]
}
###POST create new question
-
URL:
localhost:8080/questions
-
require example:
{
"action": "create",
"data": {
"description": "what is html5?",
"tags": [
"java",
"javascript"
]
}
}
- response status 200/400 for success/failed.
###POST remove question
-
remove a question by _id
-
also remove all related answers and comments
-
URL:
localhost:8080/questions
-
require example:
{
"action": "remove",
"data": {
"_id":"5510b357fc789da15cd2cf1f"
}
}
- response status 200/400 for success/failed.
###GET single answer
-
URL:
localhost:8080/answers?id=5525dfef7f133388032298e1
response example:
{
"_id": "5525dfef7f133388032298e1",
"description": "I hava no idea!",
"comments": [
{
"_id": "5525e79c7f133388032298e2",
"description": "comment test"
}
]
}
- response status 200/400 for success/failed.
###POST create new answer
-
create a new answer for qustion(by _id)
-
URL:
localhost:8080/answers
-
request example:
{
"action": "create",
"data": {
"description": "testtest",
"questionId": "5510b357fc789da15cd2cf1f"
}
}
- response status 200/400 for success/failed.
###POST remove answer
-
URL:
localhost:8080/answers
-
require example:
{
"action": "remove",
"data": {
"_id": "5511fc25456360f6698e7c51"
}
}
- response status 200/400 for success/failed.
###POST create comment
-
URL:
localhost:8080/comments
-
request example:
{
"action": "create",
"data": {
"description": "comment test",
"answerId": "5525b247055cafb91a41f7de"
}
}
- response status 200/400 for success/failed.
###POST remove comment
-
URL:
localhost:8080/comments
-
request example:
{
"action": "remove",
"data": {
"_id": "5525b81c45812d011bc59fb6"
}
}
- response status 200/400 for success/failed.