Chat
chatting room API
create room
POST
/api/chat/room/create
๋ฐฉ์ด ์๋์ง ์ฌ๋ถ๋ฅผ ํ๋จํ๊ณ , ์๋ค๋ฉด ๋ง๋ค๊ณ , ์๋ค๋ฉด ๊ทธ ๋ฐฉ์ ์ ๋ณด๋ฅผ ์ ๋ฌํฉ๋๋ค. identifier๋ ๋ฐฉ์ ์ฌ๋ถ๋ฅผ ํ๋จํ๊ธฐ ์ํ ๊ฒ์ ๋๋ค. 1:1 ์ฑํ ์ "my_id - friend_id ๋๋ friend_id - my_id"๋ก ๊ตฌ์ฑ๋๋ฉฐ, ๋์ ์น๊ตฌ์ ID ์ค ๋ ์์ ์ชฝ์ด -์ ์์ชฝ์ ๋ํ๋๊ฒ ๋ฉ๋๋ค. ex) my_id = 2, friend_id = 1 ์ผ ๋ , identifier = "1-2" participant๋ ๋ฐฉ์ ๋ค์ด๊ฐ ์๋ user๋ค์ id์ array์ ๋๋ค.
Request Body
my_id
number
1
type
string
"individual" || "group"
room_name
string
"์น๊ตฌ ์ด๋ฆ"
identifier
string
"1-2"
participant
array
[ 1, 2 ]
{
{
room_id: 1,
identifier: "1-2",
type: "individual",
room_name: "",
last_chat: "",
not_read_chat: 0,
last_read_chat_id: 0,
updatedAt: 2020-10-08T10:20:13.000Z,
},
msg: "์ฑํ
๋ฐฉ์ด ๋ง๋ค์ด์ก์ต๋๋ค."
}
get chat of the room.
GET
/api/chat/room?room_id=1&cursor=
cursor์ chatting์ ๋ถ๋ฌ์ฌ ๊ธฐ์ค์ ์ ์๋ฏธํฉ๋๋ค. cursor์ ๊ธฐ์ค์ผ๋ก chatting์ id๊ฐ cursor๋ณด๋ค ์์ ์ฑํ ์ ๋ถ๋ฌ์ค๊ฒ ๋ฉ๋๋ค. limit = 15๋ก ์ค์ ํ์ผ๋ฏ๋ก, ์ฑํ ์ 15๊ฐ์ฉ ๋ถ๋ฌ์ค๊ฒ ๋ฉ๋๋ค. ๋ง์ฝ ์ฑํ ๋ฐฉ์ ์ฑํ ์ id๊ฐ 1~30์ด๊ณ , cursor์ด 5๋ผ๋ฉด id๊ฐ 6~20์ธ ์ฑํ ์ ๋ถ๋ฌ์ค๊ฒ ๋ฉ๋๋ค.
Query Parameters
room_id
number
1
cursor
number
9999999999
{
"data": [
{"id":507,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:13.000Z"},
{"id":508,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:13.000Z"},
{"id":509,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:13.000Z"},
{"id":510,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:14.000Z"},
{"id":511,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:14.000Z"},
{"id":512,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:14.000Z"},
{"id":513,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:14.000Z"},
{"id":514,"room_id":1,"send_user_id":1,"message":"\\","not_read":0,"createdAt":"2020-10-08T10:20:14.000Z"},
{"id":518,"room_id":1,"send_user_id":1,"message":"๊พธ๋ฃจ๋ฃฐ๋ฃจ๋ฃจ๋ฃจ","not_read":0,"createdAt":"2020-10-08T14:14:07.000Z"},
{"id":544,"room_id":1,"send_user_id":2,"message":"011","not_read":0,"createdAt":"2020-10-09T05:43:21.000Z"},
{"id":545,"room_id":1,"send_user_id":2,"message":"\n\n\nddas\n\n\n\nใ
ใ
ใดใ
ใ
ใ
ใด\n\n\nใ
ใ
","not_read":0,"createdAt":"2020-10-09T05:43:26.000Z"},
{"id":546,"room_id":1,"send_user_id":2,"message":"ใ
ใ
ใ
ใ
ใดใ
ใ
\n\nใ
ใดใ
","not_read":0,"createdAt":"2020-10-09T05:43:30.000Z"},
{"id":551,"room_id":1,"send_user_id":1,"message":"ใ
ใ
","not_read":1,"createdAt":"2020-10-10T02:44:50.000Z"},
{"id":552,"room_id":1,"send_user_id":1,"message":"ใ
ใ
","not_read":1,"createdAt":"2020-10-10T02:44:51.000Z"},
{"id":553,"room_id":1,"send_user_id":1,"message":"ใ
ใ
","not_read":1,"createdAt":"2020-10-10T02:44:51.000Z"}
],
"msg":"์ฑํ
๋ชฉ๋ก์ ๋ถ๋ฌ์์ต๋๋ค."
}
get my room list
GET
/api/chat/roomList/:user_id
Path Parameters
user_id
number
1
{
"data":[
{"room_id":1,"room_name":"","type":"individual","identifier":"1-2","participant":[1],"last_chat":"ใ
ใ
","not_read_chat":0,"last_read_chat_id":558,"updatedAt":"2020-10-10T12:25:57.000Z"},
{"room_id":4,"room_name":"","type":"individual","identifier":"2-4","participant":[4],"last_chat":"์!!","not_read_chat":0,"last_read_chat_id":429,"updatedAt":"2020-10-08T10:12:12.000Z"},
{"room_id":6,"room_name":"","type":"individual","identifier":"2-8","participant":[8],"last_chat":"dsa","not_read_chat":6,"last_read_chat_id":0,"updatedAt":"2020-10-08T10:12:56.000Z"},
{"room_id":12,"room_name":"","type":"individual","identifier":"2-2","participant":[2],"last_chat":"๋ฉ์์ง","not_read_chat":0,"last_read_chat_id":557,"updatedAt":"2020-10-10T12:25:51.000Z"}
],
"msg":"์ฑํ
๋ฐฉ ๋ฆฌ์คํธ ๋ถ๋ฌ์ด"
}
Last updated
Was this helpful?