1. [조회] 게시글 조회
1.1. [성공] 게시글 조회
1.1.1. HTTP request
GET /articles/1 HTTP/1.1
Host: localhost:8080
1.1.2. HTTP response
Path | Type | Description |
---|---|---|
|
|
게시글 ID |
|
|
게시글 제목 |
|
|
게시글 내용 |
|
|
게시글 작성자 |
|
|
게시글 생성일 |
|
|
좋아요 개수 |
|
|
게시글 댓글 목록 |
|
|
댓글 Id |
|
|
댓글 제목 |
|
|
댓글 내용 |
|
|
댓글 작성자 |
|
|
댓글 생성일 |
|
|
댓글 수정일 |
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 890
{
"id" : 1,
"title" : "제목 1",
"content" : "내용 1",
"createdBy" : "sdfsdf@naver.com",
"createdAt" : "2023-06-10T16:17:47.823648",
"likeCount" : 0,
"commentResponses" : [ {
"id" : 1,
"title" : "댓글 제목 1",
"content" : "댓글 내용 1",
"createdBy" : "sdfsdf@naver.com",
"createdAt" : "2023-06-10T16:22:11.868886",
"modifiedAt" : "2023-06-10T16:22:11.868886"
}, {
"id" : 2,
"title" : "댓글 제목 2",
"content" : "댓글 내용 2",
"createdBy" : "sdfsdf@naver.com",
"createdAt" : "2023-06-10T16:22:11.868886",
"modifiedAt" : "2023-06-10T16:22:11.868886"
}, {
"id" : 3,
"title" : "댓글 제목 3",
"content" : "댓글 내용 3",
"createdBy" : "sdfsdf@naver.com",
"createdAt" : "2023-06-10T16:22:11.868886",
"modifiedAt" : "2023-06-10T16:22:11.868886"
} ]
}
1.2. [실패] 게시글 조회 실패(게시글 없음)
1.2.1. HTTP request
GET /articles/100 HTTP/1.1
Host: localhost:8080
1.2.2. HTTP response
Path | Type | Description |
---|---|---|
|
|
에러 코드 |
|
|
에러 메시지 |
|
|
에러 메시지 상세 |
HTTP/1.1 404 Not Found
Content-Type: application/json
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 111
{
"code" : "A-S-001",
"message" : "게시글이 존재하지 않습니다.",
"messageDetail" : null
}
2. [생성] 게시글 작성
2.1. [성공] 게시글 작성
2.1.1. HTTP request
헤더
Name | Description |
---|---|
|
JWT 인증 헤더 필드, Bearer 접두사 필요 |
파라미터
Parameter | Description |
---|---|
|
제목 |
|
내용 |
POST /articles/form HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJzZGZzZGZAbmF2ZXIuY29tIiwiYXV0aCI6MSwiZXhwIjoxNjg2NDYxOTI3fQ.QUan0UBklbQtnqK-lN3oQjyYZpEu5p4qR-1CEXgidkfxnKdFDTCFtNH9XXPQVun4hLq11jE5xqzoADGdgwR-Kg
Host: localhost:8080
title=%EC%A0%9C%EB%AA%A9&content=%EB%82%B4%EC%9A%A9
2.1.2. HTTP response
HTTP/1.1 201 Created
Location: /articles/3
Content-Type: text/plain;charset=UTF-8
Content-Length: 35
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
게시글이 생성되었습니다.
2.2. [실패] 게시글 작성 실패(미인증)
2.2.1. HTTP request
POST /articles/form HTTP/1.1
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Host: localhost:8080
title=%EC%A0%9C%EB%AA%A9&content=%EB%82%B4%EC%9A%A9
2.2.2. HTTP response
Path | Type | Description |
---|---|---|
|
|
에러 코드 |
|
|
에러 메시지 |
|
|
에러 메시지 상세 |
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 127
{
"code" : "G-A-002",
"message" : "인가되지 않은 자원으로 접근하였습니다.",
"messageDetail" : null
}
3. [수정] 게시글 수정
3.1. [성공] 게시글 수정
3.1.1. HTTP request
헤더
Name | Description |
---|---|
|
JWT 인증 헤더 필드, Bearer 접두사 필요 |
파라미터
Path | Type | Description |
---|---|---|
|
|
게시글 ID |
|
|
수정할 제목 |
|
|
수정할 내용 |
PUT /articles/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJzZGZzZGZAbmF2ZXIuY29tIiwiYXV0aCI6MSwiZXhwIjoxNjg2NDYxOTI3fQ.QUan0UBklbQtnqK-lN3oQjyYZpEu5p4qR-1CEXgidkfxnKdFDTCFtNH9XXPQVun4hLq11jE5xqzoADGdgwR-Kg
Content-Length: 86
Host: localhost:8080
{
"id" : "1",
"title" : "수정된 제목",
"content" : "수정된 내용"
}
3.1.2. HTTP response
Path | Type | Description |
---|---|---|
|
|
게시글 ID |
|
|
수정할 제목 |
|
|
수정할 내용 |
|
|
수정한 날짜 |
|
|
수정한 사람 |
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 170
{
"id" : 1,
"title" : "수정된 제목",
"content" : "수정된 내용",
"modifiedAt" : "2023-06-10T16:17:47.823648",
"modifiedBy" : "sdfsdf@naver.com"
}
3.2. [실패] PUT 게시글 수정 실패(게시글 없음)
3.2.1. HTTP request
PUT /articles/100 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJzZGZzZGZAbmF2ZXIuY29tIiwiYXV0aCI6MSwiZXhwIjoxNjg2NDYxOTI4fQ.-ku3JtuziAtTbaQp8NuuZfalrj9S0zocQGRvgtiBcHNFVgwuN77eSgLio3c64uXWkys1vHLFCMN9XlC24wLvug
Content-Length: 88
Host: localhost:8080
{
"id" : "100",
"title" : "수정된 제목",
"content" : "수정된 내용"
}
3.2.2. HTTP response
Path | Type | Description |
---|---|---|
|
|
에러 코드 |
|
|
에러 메시지 |
|
|
에러 메시지 상세 |
HTTP/1.1 404 Not Found
Content-Type: application/json
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 111
{
"code" : "A-S-001",
"message" : "게시글이 존재하지 않습니다.",
"messageDetail" : null
}
3.3. [실패] PUT 게시글 수정 실패(사용자 미인증)
3.3.1. HTTP request
PUT /articles/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Content-Length: 86
Host: localhost:8080
{
"id" : "1",
"title" : "수정된 제목",
"content" : "수정된 내용"
}
3.3.2. HTTP response
Path | Type | Description |
---|---|---|
|
|
에러 코드 |
|
|
에러 메시지 |
|
|
에러 메시지 상세 |
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 127
{
"code" : "G-A-002",
"message" : "인가되지 않은 자원으로 접근하였습니다.",
"messageDetail" : null
}
3.4. [실패] PUT 게시글 수정 실패(댓글 권한 없음)
3.4.1. HTTP request
PUT /articles/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJub2F1dGhAbmF2ZXIuY29tIiwiYXV0aCI6MTAwLCJleHAiOjE2ODY0NjE5Mjd9.Mk-So0GGcUYyubiM7wLewkoSNhu0YFL18Ad_IKBcRVA7io7J_HWzBfF2Mox3fEmqs3ZhGPKEdeRvbJDZDlOfxQ
Content-Length: 86
Host: localhost:8080
{
"id" : "1",
"title" : "수정된 제목",
"content" : "수정된 내용"
}
3.4.2. HTTP response
Path | Type | Description |
---|---|---|
|
|
에러 코드 |
|
|
에러 메시지 |
|
|
에러 메시지 상세 |
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 127
{
"code" : "G-A-002",
"message" : "인가되지 않은 자원으로 접근하였습니다.",
"messageDetail" : null
}
4. [삭제] 게시글 삭제
4.1. [성공] 게시글 삭제
4.1.1. HTTP request
헤더
Name | Description |
---|---|
|
JWT 인증 헤더 필드, Bearer 접두사 필요 |
파라미터
Parameter | Description |
---|---|
|
삭제할 게시글 id |
DELETE /articles/1 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJzZGZzZGZAbmF2ZXIuY29tIiwiYXV0aCI6MSwiZXhwIjoxNjg2NDYxOTI3fQ.QUan0UBklbQtnqK-lN3oQjyYZpEu5p4qR-1CEXgidkfxnKdFDTCFtNH9XXPQVun4hLq11jE5xqzoADGdgwR-Kg
Host: localhost:8080
4.1.2. HTTP response
HTTP/1.1 200 OK
Content-Type: text/plain;charset=UTF-8
Content-Length: 35
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
게시물이 삭제되었습니다.
4.2. [실패] 게시글 삭제 실패(사용자 미인증)
4.2.1. HTTP request
DELETE /articles/1 HTTP/1.1
Host: localhost:8080
4.2.2. HTTP response
Path | Type | Description |
---|---|---|
|
|
에러 코드 |
|
|
에러 메시지 |
|
|
에러 메시지 상세 |
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 127
{
"code" : "G-A-002",
"message" : "인가되지 않은 자원으로 접근하였습니다.",
"messageDetail" : null
}
4.3. [실패] 게시글 삭제 실패(댓글 권한 없음)
4.3.1. HTTP request
DELETE /articles/1 HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ0ZXN0QG5hdmVyLmNvbSIsImF1dGgiOjEwMCwiZXhwIjoxNjg2NDYxOTI3fQ.Om0iKrzUhE8EOnROyGislQibrYEYzllPYBtIQl_UzbTGmevvIKeA_F4cNOf989jInlkGhOYwvTDLCqDuyH9ZbQ
Host: localhost:8080
4.3.2. HTTP response
Path | Type | Description |
---|---|---|
|
|
에러 코드 |
|
|
에러 메시지 |
|
|
에러 메시지 상세 |
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 127
{
"code" : "G-A-002",
"message" : "인가되지 않은 자원으로 접근하였습니다.",
"messageDetail" : null
}
5. [검색] 게시글 검색
5.1. [성공] 게시글 검색
5.1.1. HTTP request
Parameter | Description |
---|---|
|
검색 조건(제목) |
|
검색 내용 |
GET /articles?SearchType=TITLE&SearchKeyword=%EC%A0%9C%EB%AA%A9%201 HTTP/1.1
Host: localhost:8080
5.1.2. HTTP response
Path | Type | Description |
---|---|---|
|
|
검색 게시글 목록 |
|
|
검색된 게시글 ID |
|
|
검색된 게시글 제목 |
|
|
검색된 게시글 내용 |
|
|
검색된 게시글 작성일 |
|
|
검색된 게시글 작성자 |
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 156
[ {
"id" : 1,
"title" : "제목 1",
"content" : "내용 1",
"createdAt" : "2023-06-10T16:17:47.823648",
"createdBy" : "sdfsdf@naver.com"
} ]
5.2. [성공] 게시글 검색(키워드 없음)
5.2.1. HTTP request
GET /articles?SearchType=&SearchKeyword=%EC%A0%9C%EB%AA%A9%201 HTTP/1.1
Host: localhost:8080
5.2.2. HTTP response
검색 키워드 없을 경우 전체 게시물 반환(기본 100개)
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Content-Length: 310
[ {
"id" : 2,
"title" : "제목 2",
"content" : "내용 2",
"createdAt" : "2023-06-10T16:19:45.584338",
"createdBy" : "sdfsdf@naver.com"
}, {
"id" : 1,
"title" : "제목 1",
"content" : "내용 1",
"createdAt" : "2023-06-10T16:17:47.823648",
"createdBy" : "sdfsdf@naver.com"
} ]
6. [좋아요] 게시글 좋아요
6.1. [좋아요 +1] 게시글 좋아요
6.1.1. HTTP request
헤더
Name | Description |
---|---|
|
JWT 인증 헤더 필드, Bearer 접두사 필요 |
파라미터 ./articles/{id}/like
Parameter | Description |
---|---|
|
좋아요 할 게시글 id |
POST /articles/1/like HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJzZGZzZGZAbmF2ZXIuY29tIiwiYXV0aCI6MSwiZXhwIjoxNjg2NDYxOTI3fQ.QUan0UBklbQtnqK-lN3oQjyYZpEu5p4qR-1CEXgidkfxnKdFDTCFtNH9XXPQVun4hLq11jE5xqzoADGdgwR-Kg
Host: localhost:8080
6.1.2. HTTP response
HTTP/1.1 200 OK
Content-Type: text/plain;charset=UTF-8
Content-Length: 37
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
좋아요 개수가 1되었습니다.
6.2. [좋아요 - 1] 게시글 좋아요 취소
6.2.1. HTTP request
헤더
Name | Description |
---|---|
|
JWT 인증 헤더 필드, Bearer 접두사 필요 |
파라미터 ./articles/{id}/like
Parameter | Description |
---|---|
|
좋아요 취소 게시글 id |
POST /articles/1/like HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJzZGZzZGZAbmF2ZXIuY29tIiwiYXV0aCI6MSwiZXhwIjoxNjg2NDYxOTI3fQ.QUan0UBklbQtnqK-lN3oQjyYZpEu5p4qR-1CEXgidkfxnKdFDTCFtNH9XXPQVun4hLq11jE5xqzoADGdgwR-Kg
Host: localhost:8080
6.2.2. HTTP response
HTTP/1.1 200 OK
Content-Type: text/plain;charset=UTF-8
Content-Length: 38
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
좋아요 개수가 -1되었습니다.