1. 게시글 CRUD API
1.1. 게시글 등록
API : POST /api/posts
1.1.1. Request
POST /api/posts HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNjg0NTkxODYzLCJleHAiOjE2ODQ1OTI0NjN9.zxALx3TtfOe9IPVzWWm28tgnWwZESRHKfjC8dMAlCng
Content-Type: application/json
Host: localhost:52660
Content-Length: 48
{
"title" : "title",
"content" : "content"
}
1.1.2. Response
HTTP/1.1 201 Created
Location: /api/posts/4
Date: Sat, 20 May 2023 14:11:02 GMT
Keep-Alive: timeout=60
Connection: keep-alive
1.2. 게시글 수정
API : PUT /api/posts/{postId}
1.2.1. Request
PUT /api/posts/1 HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNjg0NTkxODYzLCJleHAiOjE2ODQ1OTI0NjN9.zxALx3TtfOe9IPVzWWm28tgnWwZESRHKfjC8dMAlCng
Content-Type: application/json
Host: localhost:52660
Content-Length: 62
{
"title" : "update title",
"content" : "update content"
}
1.2.2. Response
HTTP/1.1 200 OK
Date: Sat, 20 May 2023 14:11:03 GMT
Keep-Alive: timeout=60
Connection: keep-alive
1.3. 게시글 삭제
API : DELETE /api/posts/{postId}
1.3.1. Request
DELETE /api/posts/1 HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNjg0NTkxODYzLCJleHAiOjE2ODQ1OTI0NjN9.zxALx3TtfOe9IPVzWWm28tgnWwZESRHKfjC8dMAlCng
Content-Type: application/json
Host: localhost:52660
1.3.2. Response
HTTP/1.1 204 No Content
Date: Sat, 20 May 2023 14:11:03 GMT
Keep-Alive: timeout=60
Connection: keep-alive
1.4. 게시글 단건 조회
API: GET /api/posts/{postId}
1.4.1. Request
GET /api/posts/1 HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:52660
1.4.2. Response
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 20 May 2023 14:11:03 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 66
{
"postId" : 1,
"title" : "title1",
"content" : "content1"
}
1.5. 게시글 스크롤 조회
API : GET /api/posts?cursor={cursor}&size={size}
1.5.1. Request Parameters
Parameter | Description |
---|---|
|
cursor부터 size 크기만큼 게시글 조회 |
|
페이지 크기 |
1.5.2. Request
GET /api/posts?cursor=10&size=10 HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:52660
1.5.3. Response
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 20 May 2023 14:11:04 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 292
{
"posts" : [ {
"postId" : 3,
"title" : "title3",
"content" : "content3"
}, {
"postId" : 2,
"title" : "title2",
"content" : "content2"
}, {
"postId" : 1,
"title" : "title1",
"content" : "content1"
} ],
"numberOfElements" : 3,
"lastCursor" : 1
}
1.6. 게시글 검색(스크롤 조회)
API : GET /api/posts/search?type={type}&value={value}&cursor={cursor}&size={size}
1.6.1. Request Parameters
Parameter | Description |
---|---|
|
검색 타입 (e.g., title, content) |
|
검색어 |
|
cursor부터 size 크기만큼 게시글 조회 |
|
페이지 크기 |
1.6.2. Request
GET /api/posts/search?type=title&value=title&cursor=10&size=10 HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:52660
1.6.3. Response
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 20 May 2023 14:11:03 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 292
{
"posts" : [ {
"postId" : 3,
"title" : "title3",
"content" : "content3"
}, {
"postId" : 2,
"title" : "title2",
"content" : "content2"
}, {
"postId" : 1,
"title" : "title1",
"content" : "content1"
} ],
"numberOfElements" : 3,
"lastCursor" : 1
}
2. 댓글 CRUD API
2.1. 댓글 조회
API : GET /api/posts/{postId}/comments
2.1.1. Request
GET /api/posts/1/comments HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:52660
2.1.2. Response
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 20 May 2023 14:11:01 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 582
{
"comments" : [ {
"commentId" : 1,
"userId" : 1,
"postId" : 1,
"content" : "content",
"createdAt" : "2023-05-20T23:11:01.737877",
"modifiedAt" : "2023-05-20T23:11:01.737877"
}, {
"commentId" : 2,
"userId" : 1,
"postId" : 1,
"content" : "content",
"createdAt" : "2023-05-20T23:11:01.745115",
"modifiedAt" : "2023-05-20T23:11:01.745115"
}, {
"commentId" : 3,
"userId" : 1,
"postId" : 1,
"content" : "content",
"createdAt" : "2023-05-20T23:11:01.751616",
"modifiedAt" : "2023-05-20T23:11:01.751616"
} ]
}
2.2. 대댓글 조회
API : GET /api/comments/{commentId}/replies
2.2.1. Request
GET /api/comments/1/replies HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:52660
2.2.2. Response
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 20 May 2023 14:11:02 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 654
{
"repliesDtos" : [ {
"commentId" : 4,
"userId" : 1,
"postId" : 1,
"parentId" : 1,
"content" : "re-content",
"createdAt" : "2023-05-20T23:11:02.275219",
"modifiedAt" : "2023-05-20T23:11:02.275219"
}, {
"commentId" : 5,
"userId" : 1,
"postId" : 1,
"parentId" : 1,
"content" : "re-content",
"createdAt" : "2023-05-20T23:11:02.280974",
"modifiedAt" : "2023-05-20T23:11:02.280974"
}, {
"commentId" : 6,
"userId" : 1,
"postId" : 1,
"parentId" : 1,
"content" : "re-content",
"createdAt" : "2023-05-20T23:11:02.286966",
"modifiedAt" : "2023-05-20T23:11:02.286966"
} ]
}
2.3. 댓글 등록
API : POST /api/posts/{postId}/comments
2.3.1. Request
POST /api/posts/1/comments HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNjg0NTkxODYyLCJleHAiOjE2ODQ1OTI0NjJ9.Eii32zT-5h4yX9D5_Oc93K9othORru1yrC9SoeosVyc
Content-Type: application/json
Host: localhost:52660
Content-Length: 33
{
"content" : "댓글 내용"
}
2.3.2. Response
HTTP/1.1 201 Created
Location: /api/posts/1/comments
Date: Sat, 20 May 2023 14:11:01 GMT
Keep-Alive: timeout=60
Connection: keep-alive
2.4. 대댓글 등록
API : POST /api/comments/{commentId}/replies
2.4.1. Request
POST /api/comments/1/replies HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNjg0NTkxODYyLCJleHAiOjE2ODQ1OTI0NjJ9.Eii32zT-5h4yX9D5_Oc93K9othORru1yrC9SoeosVyc
Content-Type: application/json
Host: localhost:52660
Content-Length: 40
{
"content" : "대댓글 입니다."
}
2.4.2. Response
HTTP/1.1 201 Created
Location: /comments/1/replies
Date: Sat, 20 May 2023 14:11:02 GMT
Keep-Alive: timeout=60
Connection: keep-alive
2.5. 댓글 수정
API : PUT /api/posts/{postId}/comments/{commentId}
2.5.1. Request
PUT /api/posts/1/comments/1 HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNjg0NTkxODYxLCJleHAiOjE2ODQ1OTI0NjF9.xTATVNMZCIiJUaaZYtjh9hWPYcu0YsHsD81csgnMPBM
Content-Type: application/json
Host: localhost:52660
Content-Length: 46
{
"content" : "수정된 댓글입니다."
}
2.5.2. Response
HTTP/1.1 200 OK
Date: Sat, 20 May 2023 14:11:01 GMT
Keep-Alive: timeout=60
Connection: keep-alive
2.6. 댓글 삭제
API : DELETE /api/comments/{commentId}
2.6.1. Request
DELETE /api/comments/1 HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNjg0NTkxODYwLCJleHAiOjE2ODQ1OTI0NjB9.cg_48U7TJj_jeCoLe5B157BZLcFMmfq03uYDX00zPwA
Content-Type: application/json
Host: localhost:52660
2.6.2. Response
HTTP/1.1 204 No Content
Date: Sat, 20 May 2023 14:11:01 GMT
Keep-Alive: timeout=60
Connection: keep-alive
3. 게시글 좋아요 API
3.1. 게시글 좋아요 요청
API : POST /api/posts/{postId}/likes
3.1.1. Request
POST /api/posts/1/likes HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNjg0NTkxODY0LCJleHAiOjE2ODQ1OTI0NjR9.Hi2GmF390cohZDh1BQ8piDmUT4shLUywnrKTiAoPwrs
Content-Type: application/json
Host: localhost:52660
Content-Length: 26
{
"like_status" : true
}
3.1.2. Response
HTTP/1.1 201 Created
Location: /api/posts/1/likes
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 20 May 2023 14:11:04 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 77
{
"postLikeId" : 1,
"postId" : 1,
"userId" : 1,
"likeStatus" : true
}
4. 댓글 좋아요 API
4.1. 댓글 좋아요 요청
API : POST /api/comment/{commentId}/likes
4.1.1. Request
POST /api/comments/1/likes HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNjg0NTkxODYyLCJleHAiOjE2ODQ1OTI0NjJ9.Eii32zT-5h4yX9D5_Oc93K9othORru1yrC9SoeosVyc
Content-Type: application/json
Host: localhost:52660
Content-Length: 26
{
"like_status" : true
}
4.1.2. Response
HTTP/1.1 201 Created
Location: /api/comments/1/likes
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 20 May 2023 14:11:02 GMT
Keep-Alive: timeout=60
Connection: keep-alive
Content-Length: 83
{
"commentLikeId" : 1,
"commentId" : 1,
"userId" : 1,
"likeStatus" : true
}