-
Notifications
You must be signed in to change notification settings - Fork 3
08. Feed API
Feed API에 대한 설명을 작성하는 공간입니다.
1. 피드 업로드하기
2. 단일 피드 조회하기
3. 다중 피드 조회하기(특정 유저)
4. 다중 피드 조회하기(친구 피드)
5. 피드 삭제하기
6. 피드 수정하기
7. 추천 피드 조회(친구 피드)
피드를 업로드하는 API입니다.
필수 파라미터 값들을 담아서 POST
로 요청합니다. 응답은 HttpStatus 객체가 제공됩니다.
POST /feeds
Host: localhost:8080
Name | Type | Description | Required |
---|---|---|---|
file | MultiPartFile | 피드에 업로드할 파일을 입력합니다. (다수 입력 가능) | X |
title | String | 피드의 제목을 입력합니다. | O |
content | String | 피드 내용을 입력합니다. | X |
publicScope | PublicScope | 피드의 공개 권한을 설정합니다. Type은 ENUM 타입으로 ALL(1), FRIENDS(2), ME(3) 중 하나로 설정해야 합니다. | O |
- 성공: HttpStatus 201 CREATED
단일 피드를 조회하는 API입니다.
URL에 타겟 피드의 작성자 Id와 피드 Id를 담아서 GET
로 요청합니다. 응답은 HttpStatus 객체와 Feed 객체가 제공됩니다.
GET /feeds/users/{targetId}/{feedId}
Host: localhost:8080
Name | Type | Description | Required |
---|---|---|---|
targetId | String | 타겟 피드의 작성자 이름을 URL에 입력합니다. | O |
feedId | int | 타겟 피드의 Id를 입력합니다. | O |
GET http://localhost:8080/feeds/users/test111/1
- 성공: HttpStatus 200 OK
Name | Type | Description |
---|---|---|
id | int | 피드의 Index를 제공합니다. |
userId | String | 피드의 작성자 Id를 제공합니다. |
title | String | 피드의 제목을 제공합니다. |
content | String | 피드의 내용을 제공합니다. |
date | Timestamp | 피드가 등록 및 수정된 시간을 제공합니다. |
publicScope | PublicScope | 피드의 공개 범위를 제공합니다. |
good | int | 피드의 좋아요 수를 제공합니다. |
commentCount | int | 피드의 댓글 수를 제공합니다. |
goodPushed | boolean | 사용자가 피드에 좋아요를 눌렀는지 여부를 제공합니다. |
fileIndex | int | 파일의 Index를 제공합니다. |
filePath | String | 파일의 경로를 제공합니다. |
fileName | String | 파일명을 제공합니다. |
{
"id": 9,
"userId": "test111",
"title": "Hello AGORA!",
"content": "AGORA Test",
"date": "2020-06-01T05:28:17.560+0000",
"publicScope": "ALL",
"good": 10,
"commentCount": 5,
"goodPushed": false,
"files": [
{
"fileIndex": 1,
"filePath": "test111\\20200601_2328581",
"fileName": "test1.png"
},
{
"fileIndex": 2,
"filePath": "test111\\20200601_2328581",
"fileName": "test2.png"
}
]
}
다중 피드를 조회하는 API입니다.
URL에 조회할 User의 targetId와 Query String에는 페이징에 사용할 커서를 담아서 GET
로 요청합니다. 응답은 HttpStatus 객체와 Feed타입의 List 객체가 제공됩니다.
GET /feeds/users/{targetId}/
Host: localhost:8080
Name | Type | Description | Required |
---|---|---|---|
targetId | String | 피드 리스트의 작성자 Id을 URL에 입력합니다. | O |
cursor | Integer | 페이징에 사용할 Cursor를 입력합니다. (Cursor를 입력하지 않으면 가장 최신 순으로 데이터를 가져옵니다.) | X |
GET http://localhost:8080/feeds/users/test111
- 성공: HttpStatus 200 OK
Name | Type | Description |
---|---|---|
id | int | 피드의 Index를 제공합니다. |
userId | String | 피드의 작성자 Id를 제공합니다. |
title | String | 피드의 제목을 제공합니다. |
content | String | 피드의 내용을 제공합니다. |
date | Timestamp | 피드가 등록 및 수정된 시간을 제공합니다. |
publicScope | PublicScope | 피드의 공개 범위를 제공합니다. |
good | int | 피드의 좋아요 수를 제공합니다. |
commentCount | int | 피드의 댓글 수를 제공합니다. |
goodPushed | boolean | 사용자가 피드에 좋아요를 눌렀는지 여부를 제공합니다. |
fileIndex | int | 파일의 Index를 제공합니다. |
filePath | String | 파일의 경로를 제공합니다. |
fileName | String | 파일명을 제공합니다. |
[
{
"id": 9,
"userId": "test111",
"title": "Hello AGORA!",
"content": "AGORA Test",
"date": "2020-06-01T05:28:17.560+0000",
"publicScope": "ALL",
"good": 10,
"commentCount": 5,
"goodPushed": false,
"files": [
{
"fileIndex": 1,
"filePath": "test111\\20200601_2328581",
"fileName": "test1.png"
},
{
"fileIndex": 2,
"filePath": "test111\\20200601_2328581",
"fileName": "test2.png"
}
]
},
{
"id": 6,
"userId": "test111",
"title": "Hello world!",
"content": "hello spring",
"date": "2020-03-31T09:10:41.602+0000",
"publicScope": "FRIENDS",
"good": 1,
"commentCount": 0,
"goodPushed": false,
"files": null
}
]
메인 화면으로 현재 친구관계에 있는 User들의 피드들을 최신순으로 조회하는 API입니다.
Query String에 페이징에 사용할 커서를 담아서 GET
로 요청합니다. 응답은 HttpStatus 객체와 Feed타입의 List 객체가 제공됩니다.
GET /feeds
Host: localhost:8080
Name | Type | Description | Required |
---|---|---|---|
cursor | Integer | 페이징에 사용할 Cursor를 입력합니다. (Cursor를 입력하지 않으면 가장 최신 순으로 데이터를 가져옵니다.) | X |
GET http://localhost:8080/feeds
- 성공: HttpStatus 200 OK
Name | Type | Description |
---|---|---|
id | int | 피드의 Index를 제공합니다. |
userId | String | 피드의 작성자 Id를 제공합니다. |
title | String | 피드의 제목을 제공합니다. |
content | String | 피드의 내용을 제공합니다. |
date | Timestamp | 피드가 등록 및 수정된 시간을 제공합니다. |
publicScope | PublicScope | 피드의 공개 범위를 제공합니다. |
good | int | 피드의 좋아요 수를 제공합니다. |
commentCount | int | 피드의 댓글 수를 제공합니다. |
goodPushed | boolean | 사용자가 피드에 좋아요를 눌렀는지 여부를 제공합니다. |
fileIndex | int | 파일의 Index를 제공합니다. |
filePath | String | 파일의 경로를 제공합니다. |
fileName | String | 파일명을 제공합니다. |
[
{
"id": 9,
"userId": "test111",
"title": "Hello AGORA!",
"content": "AGORA Test",
"date": "2020-06-01T05:28:17.560+0000",
"publicScope": "ALL",
"good": 10,
"commentCount": 5,
"goodPushed": false,
"files": [
{
"fileIndex": 1,
"filePath": "test111\\20200601_2328581",
"fileName": "test1.png"
},
{
"fileIndex": 2,
"filePath": "test111\\20200601_2328581",
"fileName": "test2.png"
}
]
},
{
"id": 8,
"userId": "test112",
"title": "Hello agora!",
"content": "hello web",
"date": "2020-03-31T09:10:54.602+0000",
"publicScope": "FRIENDS",
"good": 3,
"commentCount": 2,
"goodPushed": false,
"files": null
}
]
피드를 삭제하는 API입니다.
URL에 삭제하고자하는 피드의 Id를 담아서 DELETE
요청을 합니다. 응답은 HttpStatus 객체를 반화합니다.
DELETE /feeds/{feedId}
Host: localhost:8080
Name | Type | Description | Required |
---|---|---|---|
feedId | int | 삭제할 피드의 Id을 URL에 입력합니다. | O |
DELETE http://localhost:8080/feeds/6
- 성공: HttpStatus 204 NO_CONTENT
피드를 수정하는 API입니다.
필수 파라미터 값들을 담아서 PUT
로 요청합니다. 응답은 HttpStatus 객체가 제공됩니다.
PUT /feeds/{feedId}
Host: localhost:8080
Name | Type | Description | Required |
---|---|---|---|
file | MultiPartFile | 피드에 업로드할 파일을 입력합니다. (다수 입력 가능) | X |
title | String | 피드의 제목을 입력합니다. | O |
content | String | 피드 내용을 입력합니다. | X |
publicScope | PublicScope | 피드의 공개 권한을 설정합니다. Type은 ENUM 타입으로 ALL(1), FRIENDS(2), ME(3) 중 하나로 설정해야 합니다. | O |
- 성공: HttpStatus 200 OK
추천 알고리즘에 따라 피드들을 조회하는 API입니다. (현재 프로젝트에서는 전체 읽기 권한을 갖은 최신순의 데이터를 조회하고 있습니다.)
Query String에 페이징에 사용할 커서를 담아서 GET
로 요청합니다. 응답은 HttpStatus 객체와 Feed타입의 List 객체가 제공됩니다.
GET /feeds/recommends
Host: localhost:8080
Name | Type | Description | Required |
---|---|---|---|
cursor | Integer | 페이징에 사용할 Cursor를 입력합니다. (Cursor를 입력하지 않으면 가장 최신 순으로 데이터를 가져옵니다.) | X |
GET http://localhost:8080/feeds/recommends
- 성공: HttpStatus 200 OK
Name | Type | Description |
---|---|---|
id | int | 피드의 Index를 제공합니다. |
userId | String | 피드의 작성자 Id를 제공합니다. |
title | String | 피드의 제목을 제공합니다. |
content | String | 피드의 내용을 제공합니다. |
date | Timestamp | 피드가 등록 및 수정된 시간을 제공합니다. |
publicScope | PublicScope | 피드의 공개 범위를 제공합니다. |
good | int | 피드의 좋아요 수를 제공합니다. |
fileIndex | int | 파일의 Index를 제공합니다. |
filePath | String | 파일의 경로를 제공합니다. |
fileName | String | 파일명을 제공합니다. |
[
{
"id": 9,
"userId": "test111",
"title": "Hello AGORA!",
"content": "AGORA Test",
"date": "2020-06-01T05:28:17.560+0000",
"publicScope": "ALL",
"good": 10,
"files": [
{
"fileIndex": 1,
"filePath": "test111\\20200601_2328581",
"fileName": "test1.png"
},
{
"fileIndex": 2,
"filePath": "test111\\20200601_2328581",
"fileName": "test2.png"
}
]
},
{
"id":5,
"userId": "test112",
"title": "recommend!!",
"content": "hello agora",
"date": "2020-03-31T09:10:54.602+0000",
"publicScope": "ALL",
"good": 1,
"files": null
}
]