5.1 게시글 작성
API
POST /post
Plain Text
복사
method, 전송 url
Req
{
"post": {
"content": String,
"image": String //"imageurl1, imageurl2" 형식으로
}
}
JSON
복사
body(json)
{
"Authorization" : `Bearer ${token}`,
"Content-type" : "application/json"
}
JavaScript
복사
header
Res
// SUCCESS
{
"post": [
{
"id": String,
"content": String,
"image": String,
"createdAt": String,
"updatedAt": String,
"hearted": false,
"heartCount": 0,
"commentCount": 0,
"author": {
"_id": "작성자 id",
"username": "2",
"accountname": "2",
"following": [],
"follower": [
"follower id"
],
"followerCount": 1,
"followingCount": 0
}
}
]
}
// FAIL
// 내용 또는 이미지를 입력하지 않을 때
내용 또는 이미지를 입력해주세요.
JSON
복사
5.2 팔로워 게시글 목록(피드)
API
GET /post/feed
// paging limit skip
GET /post/feed/?limit=Number&skip=Number
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
// follow 한 사용자가 있을 때
{
"post": [
{
"id": String,
"content": "안녕하세요. 2 입니다.",
"image": String,
"createdAt": String,
"updatedAt": String,
"hearted": false,
"heartCount": 0,
"commentCount": 0,
"author": {
"_id": "작성자 id",
"username": "2",
"accountname": "2",
"following": [],
"follower": [
"follower id"
],
"followerCount": 1,
"followingCount": 0
}
}
]
}
// follow 한 사용자가 없을 때
{
"post": []
}
JSON
복사
5.3 나의 게시글 목록
API
GET /post/:accountname/userpost
// paging limit skip
GET /post/:accountname/userpost/?limit=Number&skip=Number
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
{
"post": [
{
"id": String,
"content": "안녕하세요. 2 입니다.",
"image": String,
"createdAt": String,
"updatedAt": String,
"hearted": false,
"heartCount": 0,
"commentCount": 0,
"author": {
"_id": "작성자 id",
"username": "2",
"accountname": "2",
"following": [],
"follower": [
"follower id"
],
"followerCount": 1,
"followingCount": 0
}
}
]
}
// 해당 계정의 게시물이 존재하지 않을 때
{
"post":[]
}
// FAIL
// 해당 계정이 존재하지 않을 때
해당 계정이 존재하지 않습니다.
JSON
복사
5.4 게시글 상세
API
GET /post/:post_id
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
{
"post": [
{
"id": String,
"content": String,
"image": String,
"createdAt": String,
"updatedAt": String,
"hearted": false,
"heartCount": 0,
"commentCount": 0,
"author": {
"_id": "작성자 id",
"username": "2",
"accountname": "2",
"following": [],
"follower": [
"follower id"
],
"followerCount": 1,
"followingCount": 0
}
}
]
}
// FAIL
// 게시글이 존재하지 않을 때
존재하지 않는 게시글입니다.
JSON
복사
5.5 게시글 수정
API
PUT /post/:post_id
JavaScript
복사
method, 전송 url
Req
{
"post": {
"content": String,
"image": String
}
}
JSON
복사
body(json)
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
{
"post": [
{
"id": String,
"content": String,
"image": String,
"createdAt": String,
"updatedAt": String,
"hearted": false,
"heartCount": 0,
"commentCount": 0,
"author": {
"_id": "작성자 id",
"username": "2",
"accountname": "2",
"following": [],
"follower": [
"follower id"
],
"followerCount": 1,
"followingCount": 0
}
}
]
}
// FAIL
// 게시글이 존재하지 않을 때
존재하지 않는 게시글입니다.
// 다른 사용자가 해당 게시물을 수정할 경우
잘못된 요청입니다. 로그인 정보를 확인하세요.
JSON
복사
5.6 게시글 삭제
API
DELETE /post/:post_id
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
삭제되었습니다.
// FAIL
// 게시글이 존재하지 않을 때
존재하지 않는 게시글입니다.
// 다른 사용자가 해당 게시물을 수정할 경우
잘못된 요청입니다. 로그인 정보를 확인하세요.
JSON
복사
5.7 게시글 신고
API
POST /post/:post_id/report
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
{
"report": {
"post": "포스트 id"
}
}
// FAIL
// 게시글이 존재하지 않을 때
존재하지 않는 게시글입니다.
JSON
복사