3.1 프로필 수정
API
PUT /user
JavaScript
복사
method, 전송 url
Req
{
"user":{
"username": String,
"accountname": String,
"intro": String,
"image": String
}
}
JSON
복사
body(json)
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
{
"user": {
"_id": String,
"username": String,
"accountname": String,
"intro": String,
"image": String,
"following": [],
"follower": [],
"followerCount": Number,
"followingCount": Number
}
}
// FAIL
// 가입된 accountname일 경우
이미 사용중이 계정 ID입니다.
JSON
복사
3.2 개인 프로필
API
GET /profile/:accountname
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : `Bearer ${token}`,
"Content-type" : "application/json"
}
JavaScript
복사
header
Res
// SUCCESS
{
"profile": {
"_id": String,
"username": String,
"accountname": String,
"intro": String,
"image": String,
"isfollow": Boolean,
"following": [],
"follower": [],
"followerCount": Number,
"followingCount": Number
}
}
// FAIL
// 계정이 존재하지 않을 때
해당 계정이 존재하지 않습니다.
JSON
복사
3.3 팔로우
API
POST /profile/:accountname/follow
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
// SUCCESS
// follow 한 사용자의 프로필
{
"profile": {
"_id": String,
"username": String,
"accountname": String,
"intro": String,
"image": String,
"isfollow": Boolean,
"following": [],
"follower": [
"접속한 사용자의 id"
],
"followerCount": 1,
"followingCount": 0
}
}
// FAIL
// 계정이 존재하지 않을 때
해당 계정이 존재하지 않습니다.
// 자신을 팔로우하려 할 때
{
"message": "자기 자신을 팔로우 할 수 없습니다."
}
JSON
복사
3.4 언팔로우
API
DELETE /profile/:accountname/unfollow
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : "Bearer {token}",
"Content-type" : "application/json"
}
JSON
복사
header
Res
3.5 팔로잉 리스트(내가 팔로우한 사용자 목록)
API
GET /profile/:accountname/following
// paging limit skip
GET /profile/:accountname/following?limit=Number&skip=Number
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : `Bearer ${token}`,
"Content-type" : "application/json"
}
JavaScript
복사
header
Res
// SUCCESS
// following 한 사용자가 있을 때
[
{
"_id": String,
"username": String,
"accountname": String,
"intro": String,
"image": String,
"isfollow": Boolean,
"following": [],
"follower": [
"접속한 사용자의 id"
],
"followerCount": 1,
"followingCount": 0
}
]
// following 한 사용자가 없을 때
[]
// FAIL
// 계정이 존재하지 않을 때
해당 계정이 존재하지 않습니다.
JSON
복사
3.6 팔로워 리스트(나를 팔로우한 사용자 목록)
API
GET /profile/:accountname/follower
// paging limit skip
GET /profile/:accountname/follower/?limit=Number&skip=Number
JavaScript
복사
method, 전송 url
Req
{
"Authorization" : `Bearer ${token}`,
"Content-type" : "application/json"
}
JavaScript
복사
header
Res
// SUCCESS
// follower 한 사용자가 있을 때
[
{
"_id": String,
"username": String,
"accountname": String,
"intro": String,
"image": String,
"isfollow": Boolean,
"following": [],
"follower": [
"접속한 사용자의 id"
],
"followerCount": 1,
"followingCount": 0
}
]
// follower 한 사용자가 없을 때
[]
// FAIL
// 계정이 존재하지 않을 때
해당 계정이 존재하지 않습니다.
JSON
복사