Tweet API
新增推文
POST
hostname/api/tweets
Request Body
Name
Type
Description
description*
String
推文內容
{
"status": "success",
"message": "已新增推文內容",
"data": {
"likeCount": 0,
"replyCount": 0,
"id": 51,
"UserId": 2,
"description": "dwa1231313131313131313131313131331ewadwafdwa1231313131313131313131313131331ewadwafdwa1231313131313131313131313131331ewadwafdwa12313131313131",
"updatedAt": "2022-02-25T21:57:01.579Z",
"createdAt": "2022-02-25T21:57:01.579Z"
}
}
{
"code": 401,
"status": "error",
"message": "使用者未從登入驗證獲取憑證不予使用"
}
{
"code": 500,
"status": "error",
"message": "系統出錯"
}
{
"code": 400,
"status": "error",
"message": "推文內容不能為空白"
}
{
"code": 400,
"status": "error",
"message": "推文字數限制在 140 字以內"
}
{
"code": 403,
"status": "error",
"message": "存取被拒"
}
瀏覽全部推文(會標記使用者所喜歡或所回覆的貼文)
GET
hostname/api/tweets
[
{
"id": 1,
"UserId": 2,
"description": "Repudiandae officiis et omnis ut odit ea suscipit. Possimus quod quo sit expedita ut omnis in. Magni ut consequatur iusto recusandae iusto q",
"likeCount": 0,
"replyCount": 3,
"createdAt": "2022-02-25T17:23:13.000Z",
"updatedAt": "2022-02-25T17:23:13.000Z",
"TweetAuthor": {
"id": 2,
"account": "user1",
"email": "user1@example.com",
"name": "user1",
"avatar": "https://loremflickr.com/240/240?lock=91.03083562598377",
"cover": "https://loremflickr.com/720/240?lock=12.22937183974917",
"introduction": "Aut ut veniam a aut eum inventore. Consectetur hic modi nisi et. Qui quis cum natus enim aliquid quo id odio. Corrupti et est recusandae.",
"role": "user",
"likeCount": 2,
"tweetCount": 10,
"followingCount": 0,
"followerCount": 0,
"createdAt": "2022-02-25T17:23:13.000Z",
"updatedAt": "2022-02-25T17:44:39.000Z"
},
"isLiked": true,
"isReplied": false
},
{
"id": 2,
"UserId": 2,
"description": "ea culpa sed",
"likeCount": 0,
"replyCount": 3,
"createdAt": "2022-02-25T17:23:13.000Z",
"updatedAt": "2022-02-25T17:23:13.000Z",
"TweetAuthor": {
"id": 2,
"account": "user1",
"email": "user1@example.com",
"name": "user1",
"avatar": "https://loremflickr.com/240/240?lock=91.03083562598377",
"cover": "https://loremflickr.com/720/240?lock=12.22937183974917",
"introduction": "Aut ut veniam a aut eum inventore. Consectetur hic modi nisi et. Qui quis cum natus enim aliquid quo id odio. Corrupti et est recusandae.",
"role": "user",
"likeCount": 2,
"tweetCount": 10,
"followingCount": 0,
"followerCount": 0,
"createdAt": "2022-02-25T17:23:13.000Z",
"updatedAt": "2022-02-25T17:44:39.000Z"
},
"isLiked": false,
"isReplied": true
},
.
.
]
{
"code": 401,
"status": "error",
"message": "使用者未從登入驗證獲取憑證不予使用"
}
{
"code": 500,
"status": "error",
"message": "系統出錯"
}
{
"code": 403,
"status": "error",
"message": "存取被拒"
}
瀏覽單一推文(會標記使用者所喜歡或所回覆的貼文)
GET
hostname/api/tweets/:id
{
"id": 49,
"UserId": 6,
"description": "Quia dolorem aut porro quos.\nAut quia officia quis id voluptatibus porro ullam at.\nSit nostrum ut et omnis ut perferendis enim optio molliti",
"likeCount": 1,
"replyCount": 3,
"createdAt": "2022-02-25T18:27:44.000Z",
"updatedAt": "2022-02-25T18:42:32.000Z",
"TweetAuthor": {
"id": 6,
"account": "user5",
"email": "user5@example.com",
"name": "user5",
"avatar": "https://loremflickr.com/240/240?lock=34.59144282584183",
"cover": "https://loremflickr.com/720/240?lock=87.20494885132469",
"introduction": "Ut quia expedita nobis recusandae reiciendis tempora voluptas voluptatibus aspernatur.",
"role": "user",
"likeCount": 0,
"tweetCount": 10,
"followingCount": 0,
"followerCount": 0,
"createdAt": "2022-02-25T18:27:44.000Z",
"updatedAt": "2022-02-25T18:27:44.000Z"
},
"Replies": [
{
"id": 145,
"UserId": 2,
"TweetId": 49,
"comment": "animi",
"createdAt": "2022-02-25T18:27:44.000Z",
"updatedAt": "2022-02-25T18:27:44.000Z",
"ReplyAuthor": {
"id": 2,
"account": "user1",
"email": "user1@example.com",
"name": "user1",
"avatar": "https://loremflickr.com/240/240?lock=20.527611199574313",
"cover": "https://loremflickr.com/720/240?lock=18.678490411972515",
"introduction": "Minima in velit accusamus soluta pariatur facilis voluptas.",
"role": "user",
"likeCount": 1,
"tweetCount": 10,
"followingCount": 0,
"followerCount": 0,
"createdAt": "2022-02-25T18:27:43.000Z",
"updatedAt": "2022-02-25T18:42:32.000Z"
}
},
{
"id": 146,
"UserId": 3,
"TweetId": 49,
"comment": "Quia adipisci et laboriosam tenetur exercitationem est ex laboriosam tempora.",
"createdAt": "2022-02-25T18:27:44.000Z",
"updatedAt": "2022-02-25T18:27:44.000Z",
"ReplyAuthor": {
"id": 3,
"account": "user2",
"email": "user2@example.com",
"name": "user2",
"avatar": "https://loremflickr.com/240/240?lock=4.141881000059832",
"cover": "https://loremflickr.com/720/240?lock=14.776123805762097",
"introduction": "Est quasi reiciendis culpa. Est inventore nulla. Qui unde eos blanditiis perferendis et. Eos qui odio nihil sapiente odio harum. Labore laborum distinctio praes",
"role": "user",
"likeCount": 0,
"tweetCount": 10,
"followingCount": 0,
"followerCount": 0,
"createdAt": "2022-02-25T18:27:44.000Z",
"updatedAt": "2022-02-25T18:27:44.000Z"
}
},
{
"id": 147,
"UserId": 5,
"TweetId": 49,
"comment": "Dolorum delectus eos voluptas optio eveniet pariatur illo aut magni. Inventore ullam aperiam optio voluptates. Est ut ut dolorum reiciendis ",
"createdAt": "2022-02-25T18:27:44.000Z",
"updatedAt": "2022-02-25T18:27:44.000Z",
"ReplyAuthor": {
"id": 5,
"account": "user4",
"email": "user4@example.com",
"name": "user4",
"avatar": "https://loremflickr.com/240/240?lock=59.29104474613227",
"cover": "https://loremflickr.com/720/240?lock=71.71551954719256",
"introduction": "doloremque",
"role": "user",
"likeCount": 0,
"tweetCount": 10,
"followingCount": 0,
"followerCount": 0,
"createdAt": "2022-02-25T18:27:44.000Z",
"updatedAt": "2022-02-25T18:27:44.000Z"
}
}
],
"isLiked": true,
"isReplied": true
}
{
"code": 401,
"status": "error",
"message": "使用者未從登入驗證獲取憑證不予使用"
}
{
"code": 500,
"status": "error",
"message": "系統出錯"
}
{
"code": 404,
"status": "error",
"message": "對應推文不存在"
}
{
"code": 403,
"status": "error",
"message": "存取被拒"
}
Last updated