E-Tickets - User
E-Tickets-User API 文档(普通用户专用)
Admin, Cinema Owner 的 API 见其它文档。
Resource Group ¶
User ¶
注册POST/api/user
Example URI
POST http://172.18.157.240:8000/api/user
Request
Headers
Content-Type: application/jsonBody
{
"username": "user8888",
"password": "abcd12345",
"nickname": "Superbaby"
}Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Register successfully.",
"data": {
"username": "user8888",
"nickname": "Superbaby",
"avatar": "/images/avatar/default.png"
}
}Response
409Headers
Content-Type: application/jsonBody
{
"status": "CONFLICT",
"message": "Username conflict.",
"data": {}
}Response
500Headers
Content-Type: application/jsonBody
{
"status": "UNKNOWN_ERROR",
"message": "Something wrong.",
"data": {}
}User-Info ¶
获取用户信息GET/api/user/$username
Example URI
GET http://172.18.157.240:8000/api/user/$username
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "User Infomation.",
"data": {
"username": "user8888",
"nickname": "Superbaby",
"avatar": "/images/avatar/default.png"
}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "User does not exist.",
"data": {}
}更新用户信息PATCH/api/user/$username
Example URI
PATCH http://172.18.157.240:8000/api/user/$username
Request
Headers
Content-Type: application/jsonBody
{
"nickname": "Angelababy",
"avatar": "/images/avatar/user888820180501122330.png"
}Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Update User Info successfully.",
"data": {
"username": "user8888",
"nickname": "Angelababy",
"avatar": "/images/avatar/user888820180501122330.png"
}
}Response
401Headers
Content-Type: application/jsonBody
{
"status": "UNAUTHORIZED",
"message": "Permission denied. Please login.",
"data": {}
}User Session ¶
用户登录POST/api/session/user
Example URI
POST http://172.18.157.240:8000/api/session/user
Request
Headers
Content-Type: application/jsonBody
{
"username": "user8888",
"password": "abcd12345"
}Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "User confirm.",
"data": {
"username": "user8888"
}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "User does not exit.",
"data": {}
}Response
403Headers
Content-Type: application/jsonBody
{
"status": "FORBIDDEN",
"message": "Password wrong.",
"data": {}
}用户登出DELETE/api/session/user
Example URI
DELETE http://172.18.157.240:8000/api/session/user
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Log out successfully.",
"data": {}
}Response
401Headers
Content-Type: application/jsonBody
{
"status": "UNAUTHORIZED",
"message": "You have not logged in.",
"data": {}
}User Avatar ¶
上传头像 (不会更新User数据,只拿到图片地址)POST/api/user/avatar/$username
Example URI
POST http://172.18.157.240:8000/api/user/avatar/$username
Request
Headers
Content-Type: multipart/form-dataBody
Content-Disposition: form-data; name="avatar"; filename="xxx.png"Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Upload successfully.",
"data": {
"avatar": "/images/avatar/avatarxxxx.png"
}
}Response
401Headers
Content-Type: application/jsonBody
{
"status": "UNAUTHORIZED",
"message": "Permission denied. Please login.",
"data": {}
}Movie ¶
获取电影详情GET/api/movie/$movie_id
Example URI
GET http://172.18.157.240:8000/api/movie/$movie_id
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Find movies.",
"data": {
"movie_id": 7,
"title": "The Dark Knight",
"poster": "/images/poster/the-dark-knight.png",
"director": "Christopher Nolan",
"actors": [
"Christian Bale",
"Heath Ledger",
"Aaron Eckhart"
],
"tags": [
"Crime",
"DC"
}
}
Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any movie.",
"data": {}
}Movies - by status ¶
通过电影未上映、热映中、下映检索电影GET/api/movies/status/$status_id
Example URI
GET http://172.18.157.240:8000/api/movies/status/$status_id
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Find movies.",
"data": {
"movies": [
{
"movie_id": 7,
"title": "The Dark Knight",
"poster": "/images/poster/the-dark-knight.png",
"director": "Christopher Nolan",
"actors": [
"Christian Bale",
"Heath Ledger",
"Aaron Eckhart"
],
"tags": [
"Crime",
"DC"
]
},
{
//...
}
]
}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any movie.",
"data": {}
}Movies - by keyword ¶
根据key检索电影GET/api/movies/$key_word
Example URI
GET http://172.18.157.240:8000/api/movies/$key_word
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Find movies.",
"data": {
"movies": [
{
"movie_id": 7,
"title": "The Dark Knight",
"poster": "/images/poster/the-dark-knight.png",
"director": "Christopher Nolan",
"actors": [
"Christian Bale",
"Heath Ledger",
"Aaron Eckhart"
],
"tags": [
"Crime",
"DC"
]
}
]
}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any movie.",
"data": {}
}Movies - by Title ¶
标题检索电影GET/api/movies/title/$key_word
Example URI
GET http://172.18.157.240:8000/api/movies/title/$key_word
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Find movies. Search by title",
"data": {
"movies": [
{
"movie_id": 7,
"title": "The Dark Knight",
"poster": "/images/poster/the-dark-knight.png",
"director": "Christopher Nolan",
"actors": [
"Christian Bale",
"Heath Ledger",
"Aaron Eckhart"
],
"tags": [
"Crime",
"DC"
]
}
]
}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any movie.",
"data": {}
}Movies - by Director ¶
导演检索电影GET/api/movies/director/$key_word
Example URI
GET http://172.18.157.240:8000/api/movies/director/$key_word
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Find movies. Search by director",
"data": {
"movies": [
{
"movie_id": 7,
"title": "The Dark Knight",
"poster": "/images/poster/the-dark-knight.png",
"director": "Christopher Nolan",
"actors": [
"Christian Bale",
"Heath Ledger",
"Aaron Eckhart"
],
"tags": [
"Crime",
"DC"
]
}
]
}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any movie.",
"data": {}
}Movies - by Actor ¶
演员检索电影GET/api/movies/actor/$key_word
Example URI
GET http://172.18.157.240:8000/api/movies/actor/$key_word
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Find movies. Search by actor",
"data": {
"movies": [
{
"movie_id": 7,
"title": "The Dark Knight",
"poster": "/images/poster/the-dark-knight.png",
"director": "Christopher Nolan",
"actors": [
"Christian Bale",
"Heath Ledger",
"Aaron Eckhart"
],
"tags": [
"Crime",
"DC"
]
}
]
}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any movie.",
"data": {}
}Movies - by Tag ¶
标签检索电影GET/api/movies/tag/$key_word
Example URI
GET http://172.18.157.240:8000/api/movies/tag/$key_word
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Find movies. Search by tag",
"data": {
"movies": [
{
"movie_id": 7,
"title": "The Dark Knight",
"poster": "/images/poster/the-dark-knight.png",
"director": "Christopher Nolan",
"actors": [
"Christian Bale",
"Heath Ledger",
"Aaron Eckhart"
],
"tags": [
"Crime",
"DC"
]
}
]
}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any movie.",
"data": {}
}Cinema ¶
获取电影院信息GET/api/cinema/$cinema_id
Example URI
GET http://172.18.157.240:8000/api/cinema/$cinema_id
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Cinema information.",
"data": {
"cinema_id": 1,
"cinema_name": "Qubic cinema",
"cinema_location": "Guangzhou",
"owner": "ownerqyb225"
}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cinema does not exist.",
"data": {}
}Movie halls ¶
影院所有影厅信息GET/api/cinema/$cinema_id/moviehalls
Example URI
GET http://172.18.157.240:8000/api/cinema/$cinema_id/moviehalls
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Moviehall search by cinema_id.",
"data": [
{
"cinema_id": 1,
"hall_id": 1,
"size_id": 2,
"size": 320
},
{
"cinema_id": 1,
"hall_id": 2,
"size_id": 3,
"size": 480
},
{
"cinema_id": 1,
"hall_id": 3,
"size_id": 3,
"size": 480
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any movie halls.",
"data": {}
}Movie hall ¶
影院某个影厅信息GET/api/cinema/$cinema_id/moviehall/$hall_id
Example URI
GET http://172.18.157.240:8000/api/cinema/$cinema_id/moviehall/$hall_id
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Movie Hall information.",
"data": {
"cinema_id": 1,
"hall_id": 1,
"size_id": 2,
"size": 320
}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any movie halls.",
"data": {}
}Cinemas - Owner ¶
某影院老板的所有影院信息GET/api/cinemas/owner/$owner_username
Example URI
GET http://172.18.157.240:8000/api/cinemas/owner/$owner_username
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Cinema search by owner.",
"data": [
{
"cinema_id": 1,
"cinema_name": "Qubic cinema",
"cinema_location": "Guangzhou",
"owner": "ownerqyb225"
},
{
"cinema_id": 2,
"cinema_name": "Wonderful Cinema",
"cinema_location": "Guangzhou",
"owner": "ownerqyb225"
},
{
"cinema_id": 3,
"cinema_name": "Pk Cinema",
"cinema_location": "Beijing",
"owner": "ownerqyb225"
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any cinemas.",
"data": {}
}Cinemas - Location ¶
某地的所有影院GET/api/cinemas/location/$location
Example URI
GET http://172.18.157.240:8000/api/cinemas/location/$location
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Cinema search by location.",
"data": [
{
"cinema_id": 1,
"cinema_name": "Qubic cinema",
"cinema_location": "Guangzhou",
"owner": "ownerqyb225"
},
{
"cinema_id": 2,
"cinema_name": "Wonderful Cinema",
"cinema_location": "Guangzhou",
"owner": "ownerqyb225"
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any cinemas.",
"data": {}
}Cinemas - CinemaName ¶
某名字的所有影院GET/api/cinemas/cinema-name/$cinema_name
Example URI
GET http://172.18.157.240:8000/api/cinemas/cinema-name/$cinema_name
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Cinema search by name.",
"data": [
{
"cinema_id": 1,
"cinema_name": "Qubic cinema",
"cinema_location": "Guangzhou",
"owner": "ownerqyb225"
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any cinemas.",
"data": {}
}Movie Schedule ¶
通过 schedule_id 获取排片信息GET/api/schedule/$schedule_id
Example URI
GET http://172.18.157.240:8000/api/schedule/$schedule_id
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Get schedule infomation successfully.",
"data": {
"schedule_id": 5,
"cinema_id": 1,
"hall_id": 1,
"time": "2018/05/03-15:00",
"movie_id": 8,
"price": 80,
"seat": [
120,
121,
130,
131
]
}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any schedules.",
"data": {}
}Movie Schedules - cinema_id ¶
某影院的所有排片GET/api/schedules/cinemaid/$cinema_id
Example URI
GET http://172.18.157.240:8000/api/schedules/cinemaid/$cinema_id
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Get schedules successfully.",
"data": [
{
"schedule_id": 1,
"cinema_id": 1,
"hall_id": 1,
"time": "2018/05/03-12:00",
"movie_id": 7,
"price": 80
},
{
"schedule_id": 5,
"cinema_id": 1,
"hall_id": 1,
"time": "2018/05/03-15:00",
"movie_id": 8,
"price": 80
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any schedules.",
"data": {}
}Movie Schedules - movie_id ¶
某电影的排片情况GET/api/schedules/movieid/$movie_id
Example URI
GET http://172.18.157.240:8000/api/schedules/movieid/$movie_id
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Get schedules successfully.",
"data": [
{
"schedule_id": 1,
"cinema_id": 1,
"hall_id": 1,
"time": "2018/05/03-12:00",
"movie_id": 7,
"price": 80
},
{
"schedule_id": 2,
"cinema_id": 2,
"hall_id": 1,
"time": "2018/05/03-13:00",
"movie_id": 7,
"price": 80
},
{
"schedule_id": 3,
"cinema_id": 3,
"hall_id": 1,
"time": "2018/05/03-13:00",
"movie_id": 7,
"price": 80
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any schedules.",
"data": {}
}Movie Schedules - movie_id and location ¶
某地区某电影排片情况GET/api/schedules/movieid/$movie_id/location/$location
Example URI
GET http://172.18.157.240:8000/api/schedules/movieid/$movie_id/location/$location
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Get schedules successfully.",
"data": [
{
"schedule_id": 1,
"cinema_id": 1,
"hall_id": 1,
"time": "2018/05/03-12:00",
"movie_id": 7,
"price": 80
},
{
"schedule_id": 2,
"cinema_id": 2,
"hall_id": 1,
"time": "2018/05/03-13:00",
"movie_id": 7,
"price": 80
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any schedules.",
"data": {}
}Order ¶
创建订单POST/api/order
Example URI
POST http://172.18.157.240:8000/api/order
Request
Headers
Content-Type: application/jsonBody
{
"username": "qyb225",
"schedule_id": 5,
"seat_id": 131
}Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Create order successfully.",
"data": {
"username": "qyb225",
"order_id": 7
}
}Response
400Headers
Content-Type: application/jsonBody
{
"status": "BAD_REQUEST",
"message": "Cannot create this order, check you params.",
"data": {}
}Response
401Headers
Content-Type: application/jsonBody
{
"status": "UNAUTHORIZED",
"message": "Permission denied. Please login.",
"data": {}
}Response
500Headers
Content-Type: application/jsonBody
{
"status": "INTERNAL_ERROR",
"message": "Cannot create this order",
"data": {}
}Order ¶
订单信息查询GET/api/order/$username/$order_id
Example URI
GET http://172.18.157.240:8000/api/order/$username/$order_id
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Get order information.",
"data": {
"order_id": 2,
"username": "qyb225",
"schedule_id": 5,
"seat": 121,
"is_paid": 1
}
}Response
401Headers
Content-Type: application/jsonBody
{
"status": "UNAUTHORIZED",
"message": "Permission denied. Please login.",
"data": {}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any order.",
"data": {}
}Order Payment ¶
支付订单PATCH/api/order/payment/$order_id
Example URI
PATCH http://172.18.157.240:8000/api/order/payment/$order_id
Request
Body
{
"username": "qyb225",
"is_paid": true
}Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Successful payment.",
"data": {
"order_id": "1"
}
}Response
401Headers
Content-Type: application/jsonBody
{
"status": "UNAUTHORIZED",
"message": "Permission denied. Please login.",
"data": {}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Order does not exist or has been paid.",
"data": {}
}Paid Orders ¶
用户所有支付订单GET/api/orders/$username/paid-orders
Example URI
GET http://172.18.157.240:8000/api/orders/$username/paid-orders
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Find orders!",
"data": [
{
"order_id": 1,
"username": "qyb225",
"schedule_id": 5,
"seat": 120,
"is_paid": 1
},
{
"order_id": 2,
"username": "qyb225",
"schedule_id": 5,
"seat": 121,
"is_paid": 1
}
]
}Response
401Headers
Content-Type: application/jsonBody
{
"status": "UNAUTHORIZED",
"message": "Permission denied. Please login.",
"data": {}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any paid order.",
"data": {}
}Unpaid Orders ¶
用户所有未支付订单GET/api/orders/$username/unpaid-orders
Example URI
GET http://172.18.157.240:8000/api/orders/$username/unpaid-orders
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Find unpaid orders!",
"data": [
{
"order_id": 3,
"username": "qyb225",
"schedule_id": 5,
"seat": 130,
"is_paid": 0
},
{
"order_id": 4,
"username": "qyb225",
"schedule_id": 5,
"seat": 131,
"is_paid": 0
}
]
}Response
401Headers
Content-Type: application/jsonBody
{
"status": "UNAUTHORIZED",
"message": "Permission denied. Please login.",
"data": {}
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any unpaid order.",
"data": {}
}Comment ¶
删除评论DELETE/api/comment
Example URI
DELETE http://172.18.157.240:8000/api/comment
Request
Headers
Content-Type: application/jsonBody
{
"username": "qyb225",
"movie_id": 8,
}Response
200Headers
Content-Type: applicaton/jsonBody
{
"status": "OK",
"message": "Delete this comment successfully.",
"data": {}
}Response
401Headers
Content-Type: application/jsonBody
{
"status": "UNAUTHORIZED",
"message": "Permission denied.",
"data": {}
}Movie's All Comments ¶
一部电影的全部评论GET/api/comments/all-comments/movieid/$movie_id
Example URI
GET http://172.18.157.240:8000/api/comments/all-comments/movieid/$movie_id
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "All comments.",
"data": [
{
"comment_id": 11,
"username": "qyb225",
"movie_id": 9,
"is_recommended": 1,
"comment_content": "超级好看,墙裂推荐!",
"is_spoiled": 0,
"time": "2018-05-26 20:39:19"
},
{
"comment_id": 10,
"username": "user2",
"movie_id": 9,
"is_recommended": 0,
"comment_content": "我觉得这个电影一般吧",
"is_spoiled": 0,
"time": "2018-05-26 20:33:38"
},
{
"comment_id": 9,
"username": "user1",
"movie_id": 9,
"is_recommended": 1,
"comment_content": "主角死了,死得好惨",
"is_spoiled": 1,
"time": "2018-05-26 20:32:49"
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any comment.",
"data": {}
}Amount of movie's comments ¶
一部电影的全部评论数量GET/api/comments/all-comments/movieid/$movie_id/amount
Example URI
GET http://172.18.157.240:8000/api/comments/all-comments/movieid/$movie_id/amount
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Amount of comments.",
"data": {
"amount": 3
}
}One Page of Movie's All Comments ¶
获取电影全部评论中的一页GET/api/comments/all-comments/movieid/$movie_id/page/$page_id/page-amount/$max_page_item_amount
Example URI
GET http://172.18.157.240:8000/api/comments/all-comments/movieid/$movie_id/page/$page_id/page-amount/$max_page_item_amount
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "All comments.",
"data": [
{
"comment_id": 11,
"username": "qyb225",
"movie_id": 9,
"is_recommended": 1,
"comment_content": "超级好看,墙裂推荐!",
"is_spoiled": 0,
"time": "2018-05-26 20:39:19"
},
{
"comment_id": 10,
"username": "user2",
"movie_id": 9,
"is_recommended": 0,
"comment_content": "我觉得这个电影一般吧",
"is_spoiled": 0,
"time": "2018-05-26 20:33:38"
},
{
"comment_id": 9,
"username": "user1",
"movie_id": 9,
"is_recommended": 1,
"comment_content": "主角死了,死得好惨",
"is_spoiled": 1,
"time": "2018-05-26 20:32:49"
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any comment.",
"data": {}
}Movie's Unspoiled Comments ¶
一部电影的非剧透评论GET/api/comments/unspoiled-comments/movieid/$movie_id
Example URI
GET http://172.18.157.240:8000/api/comments/unspoiled-comments/movieid/$movie_id
Response
200Headers
Content-Type: applicaton/jsonBody
{
"status": "OK",
"message": "Unspoiled comments.",
"data": [
{
"comment_id": 11,
"username": "qyb225",
"movie_id": 9,
"is_recommended": 1,
"comment_content": "超级好看,墙裂推荐!",
"is_spoiled": 0,
"time": "2018-05-26 20:39:19"
},
{
"comment_id": 10,
"username": "user2",
"movie_id": 9,
"is_recommended": 0,
"comment_content": "我觉得这个电影一般吧",
"is_spoiled": 0,
"time": "2018-05-26 20:33:38"
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any comment.",
"data": {}
}Amount of movie's unspoiled comments ¶
一部电影的非剧透评论数量GET/api/comments/unspoiled-comments/movieid/$movie_id/amount
Example URI
GET http://172.18.157.240:8000/api/comments/unspoiled-comments/movieid/$movie_id/amount
Response
200Headers
Content-Type: applicaiton/jsonBody
{
"status": "OK",
"message": "Amount of unspoiled comments.",
"data": {
"amount": 2
}
}One Page of Movie's Unspoiled Comments ¶
获取电影非剧透评论中的一页GET/api/comments/unspoiled-comments/movieid/$movie_id/page/$page_id/page-amount/$max_page_item_amount
Example URI
GET http://172.18.157.240:8000/api/comments/unspoiled-comments/movieid/$movie_id/page/$page_id/page-amount/$max_page_item_amount
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Unspoiled comments.",
"data": [
{
"comment_id": 10,
"username": "user2",
"movie_id": 9,
"is_recommended": 0,
"comment_content": "我觉得这个电影一般吧",
"is_spoiled": 0,
"time": "2018-05-26 20:33:38"
},
{
"comment_id": 11,
"username": "qyb225",
"movie_id": 9,
"is_recommended": 1,
"comment_content": "超级好看,墙裂推荐!",
"is_spoiled": 0,
"time": "2018-05-26 20:39:19"
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any comment.",
"data": {}
}User's comments ¶
某用户发布的所有评论GET/api/comments/user/$username
Example URI
GET http://172.18.157.240:8000/api/comments/user/$username
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Get user comments.",
"data": [
{
"comment_id": 11,
"username": "qyb225",
"movie_id": 9,
"is_recommended": 1,
"comment_content": "超级好看,墙裂推荐!",
"is_spoiled": 0,
"time": "2018-05-26 20:39:19"
},
{
"comment_id": 1,
"username": "qyb225",
"movie_id": 8,
"is_recommended": 1,
"comment_content": "这部电影真好看,墙裂推荐",
"is_spoiled": 0,
"time": "2018-05-26 19:17:54"
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any comment.",
"data": {}
}Amount of user's comments ¶
某用户发布的评论数量GET/api/comments/user/$username/amount
Example URI
GET http://172.18.157.240:8000/api/comments/user/$username/amount
Response
200Headers
Content-Type: applicaiton/jsonBody
{
"status": "OK",
"message": "Amount of comments.",
"data": {
"amount": 2
}
}One Page of User's Comments ¶
获取某用户评论中的一页GET/api/comments/user/$username/page/$page_id/page-amount/$max_page_item_amount
Example URI
GET http://172.18.157.240:8000/api/comments/user/$username/page/$page_id/page-amount/$max_page_item_amount
Response
200Headers
Content-Type: application/jsonBody
{
"status": "OK",
"message": "Get user comments.",
"data": [
{
"comment_id": 11,
"username": "qyb225",
"movie_id": 9,
"is_recommended": 1,
"comment_content": "超级好看,墙裂推荐!",
"is_spoiled": 0,
"time": "2018-05-26 20:39:19"
},
{
"comment_id": 1,
"username": "qyb225",
"movie_id": 8,
"is_recommended": 1,
"comment_content": "这部电影真好看,墙裂推荐",
"is_spoiled": 0,
"time": "2018-05-26 19:17:54"
}
]
}Response
404Headers
Content-Type: application/jsonBody
{
"status": "NOT_FOUND",
"message": "Cannot find any comment.",
"data": {}
}
/api/commentExample URI
Headers
Content-Type: application/jsonBody
{ "username": "qyb225", "movie_id": 8, "is_recommended": true, "comment_content": "这部电影真好看,墙裂推荐", "is_spoiled": false }200Headers
Content-Type: application/jsonBody
{ "status": "OK", "message": "Comment created!", "data": { "comment_id": 4, "username": "qyb225", "movie_id": 8, "is_recommended": true, "comment_content": "这部电影真好看,墙裂推荐", "is_spoiled": false } }400Headers
Content-Type: application/jsonBody
{ "status": "BAD_REQUEST", "message": "Movie is not exists.", "data": {} }401Headers
Content-Type: application/jsonBody
{ "status": "UNAUTHORIZED", "message": "Permission denied.", "data": {} }409Headers
Content-Type: application/jsonBody
{ "status": "CONFLICT", "message": "You have made a comment.", "data": {} }500Headers
Content-Type: applicaton/jsonBody
{ "status": "UNKNOWN_ERROR", "message": "Something wrong.", "data": {} }