- RESTful APIs running on
localhost:50051
GET
/mystory
(Get stories written by the user)
key value description Authorization Bearer token
The jwt token
http code content-type response 200
application/json
{"message": "Success", "storyIdList": string[]}
401
,500
text/plain
N/A
POST
/story
(Create a story)
key value description Authorization Bearer token
The jwt token
key required data type description authorId true string ObjectId of the author content true string Content of the story title true string Title of the story subtitle true string Subtitle of the story tags true string[] Tags of the story
http code content-type response 200
application/json
{"message": "Success", "storyId": "ObjectId of the new story"}
401
,400
,500
text/plain
N/A
GET
/story
(Get a story by given id)
key required data type description storyId true string ObjectId of the story
type story = {
author: string
authorId: string
content: string
title: string
subTitle: string
createdAt: google.protobuf.Timestamp
comments: Comment
tags: string[]
}
http code content-type response 200
application/json
{"message": "Success", "story": story}
400
,404
,500
text/plain
N/A
DELETE
/story
(Delete a story by given id)
key value description Authorization Bearer token
The jwt token
key required data type description storyId true string ObjectId of the story deleterId true string ObjectId of the deleter
http code content-type response 200
application/json
{"message": "Success"}
400
,500
text/plain
N/A
GET
/recommend
(Get resommended stories, WIP)
key value description Authorization Bearer token
The jwt token
key required data type description userId true string ObjectId of the user count true int Number of story to retrieve skip true int --
http code content-type response 200
application/json
{"message": "Success", "storyIdList": string[]}
400
,500
text/plain
N/A
POST
/comment
(Add a new comment to the story)
key value description Authorization Bearer token
The jwt token
key required data type description comment true string The content of the comment commenterId true string The id of the commenter commentedStoryId true string The story to comment on
http code content-type response 200
application/json
{"message": "Success", "commentId: "id of the comment"}
400
,401
,500
text/plain
N/A
DELETE
/comment
(Delete a comment of a story)
key value description Authorization Bearer token
The jwt token
key required data type description commentId true string The id of the comment deleterId true string The id of the deleter
http code content-type response 200
application/json
{"message": "Success"}
400
,401
,500
text/plain
N/A
GET
/comment
(Get comments from specific story)
key required data type description storyId true string N/A
http code content-type response 200
application/json
{"message": "Success", "comments": list of comments}
500
text/plain
N/A
POST
/subComment
(Add a new subComment to the comment)
key value description Authorization Bearer token
The jwt token
key required data type description content true string The content of the comment commenterId false string The id of the commenter repliedCommentId true string The comment to comment on storyId true string The storyid of the comment
http code content-type response 200
application/json
{"message": "Success", "subCommentId: "id of the subComment"}
401
,500
text/plain
N/A
DELETE
/comment
(Delete a subComment of a comment)
key value description Authorization Bearer token
The jwt token
key required data type description commentId true string The id of the comment deleterId true string The id of the deleter
http code content-type response 200
application/json
{"message": "Success"}
400
,401
, 500`text/plain
N/A
GET
/search
(Search for the stories)
key required data type description tag true string Tag for searching count true int Number of story to retrieve skip true int --
http code content-type response 200
application/json
{"message": "Success", "storyIdList: string list of ids}
500
text/plain
N/A