Skip to content

User API 문서

kimjunbo edited this page Nov 6, 2023 · 2 revisions

User API 문서

Table of Contents

  • 회원가입
    • Request
    • Request Fields
    • Response
    • Response Fields
  • 로그인
    • Request
    • Request Fields
    • Response
    • Response Fields
  • 유저 정보 조회
    • Request
    • Request Fields
    • Response
    • Response Fields

회원가입

Request

POST /users HTTP/1.1 Content-Type: application/json;charset=UTF-8
Accept: application/json
Content-Length: 142
Host: localhost:8080

{
  "username" : "kimjunbo",
  "password" : "atticket",
  "email" : "[email protected]",
  "name" : "김준영",
  "phone" : "010-1234-1234"
}

Request Fields

Path Type Description
username String 유저 아이디
password String 비밀번호
email String 이메일
name String 이름
phone String 전화번호

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 68

{
  "code" : 200,
  "message" : "요청에 성공하셨습니다."
}

Response Fields

Path Type Description
code Number 결과코드
message String 결과 메세지

로그인

Request

POST /users/token HTTP/1.1 Content-Type: application/json;charset=UTF-8
Accept: application/json
Content-Length: 56
Host: localhost:8080

{
  "username" : "kimjunbo",
  "password" : "atticket"
}

Request Fields

Path Type Description
username String 유저 아이디
password String 비밀번호

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 327

{
  "code" : 200,
  "message" : "요청에 성공하셨습니다.",
  "data" : {
    "access_token" : "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lk...",
    "expires_in" : 3600,
    "refresh_expires_in" : 604800,
    "refresh_token" : "eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJh...",
    "token_type" : "Bearer"
  }
}

Response Fields

Path Type Description
code Number 결과코드
message String 결과 메세지
data.access_token String access 토큰
data.expires_in Number access 토큰 만료시간
data.refresh_expires_in Number refresh 토큰 만료시간
data.refresh_token String refresh 토큰
data.token_type String 토큰 타입

유저 정보 조회

Request

GET /users HTTP/1.1 Authorization: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lk...
Host: localhost:8080

Request Fields

Name Description
Authorization Basic auth credentials

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 218

{
  "code" : 200,
  "message" : "요청에 성공하셨습니다.",
  "data" : {
    "userId" : "keycloak-uuid",
    "email" : "keycloak-email",
    "name" : "keycloak-name",
    "phone" : "keycloak-phone_number"
  }
}

Response Fields

Path Type Description
code Number 결과코드
message String 결과 메세지
data.userId String 유저 아이디
data.email String 이메일
data.name String 이름
data.phone String 전화번호