채팅 메시지 불러오기 - DevCamp2Flame/FlameTalk_Server GitHub Wiki
Chat Message history API
Request
Method
GET
URL
/api/chat/history/{roomId}
Header
| Method |
Parameter |
Description |
| Content-Type |
application/json |
|
| ACCESS-TOKEN |
{accessToken} |
access token값 |
- 현재는 ACCESS-TOKEN 없어도 송신 가능합니다.
Query Parameter
| Field |
Type |
Description |
Required |
| lastReadMessageId |
String |
마지막으로 읽은 메시지 |
N |
- ex)
/api/chat/history/{roomId}?lastReadMessageId=1
Response
Header
| Method |
Parameter |
Description |
| statusCode |
{statusCode} |
|
Body
| Field |
Type |
Description |
| status |
Integer |
응답 코드 |
| message |
String |
응답 메세지 |
| data |
Object |
생성된 메시지 정보. data 참고 |
data
| Field |
Type |
Description |
| message_id |
String |
메시지 id |
| message_type |
String |
메시지 타입 |
| room_id |
String |
채팅방 id |
| sender_id |
String |
발신자 id |
| nickname |
String List |
발신자 별명 |
| contents |
String |
메시지 내용 |
| file_url |
String |
파일 url |
| created_at |
String |
메시지 생성 시각 |
SUCCESS example
{
"status": 200,
"message": "메시지 조회 성공",
"data":[
{
"message_id": "4",
"message_type": "TALK",
"sender_id": "1",
"nickname": "darom",
"room_id": "1",
"contents": "hi",
"file_url": null,
"created_at": "2017-05-03T22:30:54.234"
},
{
"message_id": "3",
"message_type": "TALK",
"sender_id": "1",
"nickname": "darom",
"room_id": "1",
"contents": "hi",
"file_url": null,
"created_at": "2016-05-03T22:30:54.234"
},
{
"message_id": "2",
"message_type": "TALK",
"sender_id": "1",
"nickname": "darom",
"room_id": "1",
"contents": "hi",
"file_url": null,
"created_at": "2015-05-03T22:30:54.234"
}
]
}
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",
}