백엔드 지하철 미션 API 예시

유저


회원가입

HTTP request

POST /api/customers HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 35
Host: localhost:8080

{
  "email" : "[email protected]"
  "password" : "password0!"
  "username" : "루나"
}

HTTP response

HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: **/login**
Content-Type: application/json
Content-Length: 47

로그인

HTTP request

POST /api/auth/login HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 35
Host: localhost:8080

{
  "email" : "[email protected]"
  "password" : "password0!"
}

HTTP response

HTTP/1.1 200 Ok
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: /
Content-Type: application/json
Content-Length: 47

{
  "accessToken" : "XXXXXX"
}

회원 정보 조회

HTTP request

GET /api/customers/me HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 35
Host: localhost:8080
**Authorization: Bearer XXXXXXXXXXXXXX**

HTTP response

HTTP/1.1 200 Ok
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/json
Content-Length: 47

{
  "email" : "[email protected]"
  "username" : "루나"
}

회원 정보 수정

비밀번호 수정