[KR] 유저 API - 2022-dimipay-recruit/Flutter-Server Wiki

유저 API


POST /users

request:

  • body (googleUid나 kakaoUid 둘중 하나는 있어야 함)
    • link: string (/^[a-z0-9]{6,16}$/)
    • nickname: string (/^.{3,20}$/)
    • email: string
    • profileImage: string
    • description: string
    • googleUid?: string (/^[a-zA-Z0-9]+$/)
    • kakaoUid?: string (/^kakao:[0-9]+$/)

response:

{
  status: 'success',
  data: {
    userId: string (UUID)
  }
}

error:

  • 400
    • Invalid social information
    • Duplicated unique user information

GET /users

request:

  • query (?page[index]=0&page[size]=100&page[order]=desc와 같은 형태로 요청)
    • page
      • index?: string (/^[1-9][0-9]+$|^[0-9]$/, 기본 0)
      • size?: string (/^[1-9][0-9]+$|^[0-9]$/, 기본 100)
      • order?: 'desc' | 'asc' (기본 asc)

response:

{
    status: 'success',
    data: {
      id: string (UUID),
      link: string (/^[a-z0-9]{6,16}$/),
      nickname: string (/^.{3,20}$/),
      email: string,
      profileImage: string,
      description: string
    }[]
}

PATCH /users/id/:id

request:

  • params
    • id: string (UUID)
  • body
    • link?: string (/^[a-z0-9]{6,16}$/)
    • nickname?: string (/^.{3,20}$/)
    • email?: string
    • profileImage?: string
    • description?: string
  • header
    • authorization: string (Bearer + JWT)

response:

{
  status: 'success',
  (변경된 요소 + id, link, googleUid, kakaoUid 응답)
  data: {
    id: string (UUID),
    link: string (/^[a-z0-9]{6,16}$/),
    nickname?: string (/^.{3,20}$/),
    email?: string,
    profileImage?: string,
    description?: string,
    googleUid: string (/^[a-zA-Z0-9]+$/),
    kakaoUid: string (/^kakao:[0-9]+$/)
  }
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type
      • Invalid user information
    • Duplicated userCondition
    • Lack of user information
  • 401
    • Unauthorized user

GET /users/id/:id

request:

  • params
    • id: string (UUID)
  • header
    • authorization?: string (Bearer + JWT)

response:

{
  status: 'success',
  (JWT에 의한 유저 정보가 해당 유저 정보와 같다면 소셜 정보와 같이 응답)
  data: {
    id: string (UUID),
    link: string (/^[a-z0-9]{6,16}$/),
    nickname: string (/^.{3,20}$/),
    email: string,
    profileImage: string,
    description: string,
    googleUid?: string (/^[a-zA-Z0-9]+$/),
    kakaoUid?: string (/^kakao:[0-9]+$/)
  }
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type

PATCH /users/link/:link

request:

  • params
    • link: string (/^[a-z0-9]{6,16}$/)
  • body
    • link?: string (/^[a-z0-9]{6,16}$/)
    • nickname?: string (/^.{3,20}$/)
    • email?: string
    • profileImage?: string
    • description?: string
  • header
    • authorization: string (Bearer + JWT)

response:

{
  status: 'success',
  (변경된 요소 + id, link, googleUid, kakaoUid 응답)
  data: {
    id: string (UUID),
    link: string (/^[a-z0-9]{6,16}$/),
    nickname?: string (/^.{3,20}$/),
    email?: string,
    profileImage?: string,
    description?: string,
    googleUid: string (/^[a-zA-Z0-9]+$/),
    kakaoUid: string (/^kakao:[0-9]+$/)
  }
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type
      • Invalid user information
    • Duplicated userCondition
    • Lack of user information
  • 401
    • Unauthorized user

GET /users/link/:link

request:

  • params
    • link: string (/^[a-z0-9]{6,16}$/)
  • header
    • authorization?: string (Bearer + JWT)

response:

{
  status: 'success',
  (JWT에 의한 유저 정보가 해당 유저 정보와 같다면 소셜 정보와 같이 응답)
  data: {
    id: string (UUID),
    link: string (/^[a-z0-9]{6,16}$/),
    nickname: string (/^.{3,20}$/),
    email: string,
    profileImage: string,
    description: string,
    googleUid?: string (/^[a-zA-Z0-9]+$/),
    kakaoUid?: string (/^kakao:[0-9]+$/)
  }
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type

PATCH /users/googleUid/:googleUid

request:

  • params
    • googleUid: string (/^[a-zA-Z0-9]+$/)
  • body
    • link?: string (/^[a-z0-9]{6,16}$/)
    • nickname?: string (/^.{3,20}$/)
    • email?: string
    • profileImage?: string
    • description?: string
  • header
    • authorization: string (Bearer + JWT)

response:

{
  status: 'success',
  (변경된 요소 + id, link, googleUid, kakaoUid 응답)
  data: {
    id: string (UUID),
    link: string (/^[a-z0-9]{6,16}$/),
    nickname?: string (/^.{3,20}$/),
    email?: string,
    profileImage?: string,
    description?: string,
    googleUid: string (/^[a-zA-Z0-9]+$/),
    kakaoUid: string (/^kakao:[0-9]+$/)
  }
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type
      • Invalid user information
    • Duplicated userCondition
    • Lack of user information
  • 401
    • Unauthorized user

GET /users/googleUid/:googleUid

request:

  • params
    • googleUid: string (/^[a-zA-Z0-9]+$/)
  • header
    • authorization?: string (Bearer + JWT)

response:

{
  status: 'success',
  (JWT에 의한 유저 정보가 해당 유저 정보와 같다면 소셜 정보와 같이 응답)
  data: {
    id: string (UUID),
    link: string (/^[a-z0-9]{6,16}$/),
    nickname: string (/^.{3,20}$/),
    email: string,
    profileImage: string,
    description: string,
    googleUid?: string (/^[a-zA-Z0-9]+$/),
    kakaoUid?: string (/^kakao:[0-9]+$/)
  }
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type

PATCH /users/kakaoUid/:kakaoUid

request:

  • params
    • kakaoUid: string (/^kakao:[0-9]+$/)
  • body
    • link?: string (/^[a-z0-9]{6,16}$/)
    • nickname?: string (/^.{3,20}$/)
    • email?: string
    • profileImage?: string
    • description?: string
  • header
    • authorization: string (Bearer + JWT)

response:

{
  status: 'success',
  (변경된 요소 + id, link, googleUid, kakaoUid 응답)
  data: {
    id: string (UUID),
    link: string (/^[a-z0-9]{6,16}$/),
    nickname?: string (/^.{3,20}$/),
    email?: string,
    profileImage?: string,
    description?: string,
    googleUid: string (/^[a-zA-Z0-9]+$/),
    kakaoUid: string (/^kakao:[0-9]+$/)
  }
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type
      • Invalid user information
    • Duplicated userCondition
    • Lack of user information
  • 401
    • Unauthorized user

GET /users/kakaoUid/:kakaoUid

request:

  • params
    • kakaoUid: string (/^kakao:[0-9]+$/)
  • header
    • authorization?: string (Bearer + JWT)

response:

{
  status: 'success',
  (JWT에 의한 유저 정보가 해당 유저 정보와 같다면 소셜 정보와 같이 응답)
  data: {
    id: string (UUID),
    link: string (/^[a-z0-9]{6,16}$/),
    nickname: string (/^.{3,20}$/),
    email: string,
    profileImage: string,
    description: string,
    googleUid?: string (/^[a-zA-Z0-9]+$/),
    kakaoUid?: string (/^kakao:[0-9]+$/)
  }
}

error:

  • 400
    • Invalid authorization token
    • Invalid authorization header type

GET /users/:id/loves

request:

  • params
    • id: string, 유저 UUID
  • header
    • authorization: string (Bearer + JWT)

response:

{
  status: 'success',
  data: {
    id: string (UUID),
    title: string (/^.{1,50}$/),
    createdAt: string (ISO 8601 time),
    updatedAt: string (ISO 8601 time),
    isAnnony: boolean (익명인지 여부),
    isCommunity: boolean (커뮤니티 질문인지 여부, 커뮤니티이므로 언제나 true),
    imageLink: string (없을 경우 빈 값),
    denied: boolean (답변이 거절되었는지),
    reveiverId: string | null (수신인, 커뮤니티이므로 언제나 null),
    authorId: string (UUID, 작성인),
    loveCount: number (좋아요 수),
    answerCount: number (답변 수)
  }[]
}

GET /users/:id/bookmarks

request:

  • params
    • id: string, 유저 UUID
  • header
    • authorization: string (Bearer + JWT)

response:

{
  status: 'success',
  data: {
    id: string (UUID),
    title: string (/^.{1,50}$/),
    createdAt: string (ISO 8601 time),
    updatedAt: string (ISO 8601 time),
    isAnnony: boolean (익명인지 여부),
    isCommunity: boolean (커뮤니티 질문인지 여부, 커뮤니티이므로 언제나 true),
    imageLink: string (없을 경우 빈 값),
    denied: boolean (답변이 거절되었는지),
    reveiverId: string | null (수신인, 커뮤니티이므로 언제나 null),
    authorId: string (UUID, 작성인),
    loveCount: number (좋아요 수),
    answerCount: number (답변 수)
  }[]
}