파일 생성 - DevCamp2Flame/FlameTalk_Server GitHub Wiki
File create API
Request
Method
POST
URL
/api/file
Header
Method |
Parameter |
Description |
Content-Type |
multipart/form-data |
|
ACCESS-TOKEN |
{token} |
access token값 |
Body
Field |
Type |
Description |
Required |
file |
File |
파일 |
Y |
chatroomId |
String |
채팅 방 id |
채팅방에서 업로드 된 파일인 경우 Y |
Response
Header
Method |
Parameter |
Description |
statusCode |
{statusCode} |
|
Location |
/api/file/{fileId} |
성공한 경우 생성된 파일 id에 대한 URI |
Body
Field |
Type |
Description |
code |
Integer |
응답 코드 |
message |
String |
응답 메세지 |
data |
Object |
data 참고 |
data
Field |
Type |
Description |
fileId |
Long |
파일 id 값 |
title |
String |
파일 이름 |
extension |
String |
파일 확장자 |
url |
String |
S3 URL |
createdDate |
LocalDateTime |
파일 업로드한 날짜 |
SUCCESS example
{
"status": 200,
"message": "파일 생성 성공",
"data": {
"fileId": 34,
"title": "flametalk_48a2291e7cbed1be50aa28880b58477e_20222016102059",
"extension": "jpeg",
"url": "https://flametalk-bucket.s3.ap-northeast-2.amazonaws.com/profile/flametalk_48a2291e7cbed1be50aa28880b58477e_20222016102059.jpeg",
"createdDate": "2022-02-16T10:20:59.75639"
}
}
File Capacity FAIL Example
{
"status": 400,
"message": "파일 용량 초과",
"data": null
}
Error Code
Code |
Error Messsage |
400 |
Bad Request |
401 |
Unauthorized |
500 |
Server Error |
FAIL example
{
"status": 400,
"message": "잘못된 요청입니다.",
"error": "BAD_REQUEST",
"code": "BAD_REQUEST",
"timestamp": "2022-01-18T19:30:16.3072905",
}