Skip to content
wish9 edited this page Apr 26, 2023 · 12 revisions
스택오버플로우 애플리케이션

스택오버플로우 애플리케이션

version 0.0.1-SNAPSHOT

We Won Jong <[email protected]>

v1.0.0, 2023.04.19


1. MemberController

1.1. 회원 등록

curl-request
$ curl 'http://localhost:8080/members' -i -X POST \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -H 'Accept: application/json' \
    -d '{
  "email" : "[email protected]",
  "password" : "firstPW111",
  "memberNickName" : "NickName1"
}'
http-request
POST /members HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: application/json
Content-Length: 100
Host: localhost:8080

{
  "email" : "[email protected]",
  "password" : "firstPW111",
  "memberNickName" : "NickName1"
}
Table 1. request-fields
Path Type Description

email

String

이메일

memberNickName

String

닉네임

password

String

비밀번호

http-https://xxx[response]
HTTP/1.1 201 Created
Location: /members/1
Content-Type: application/json
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 166

{
  "memberId" : 1,
  "email" : "[email protected]",
  "profileImage" : "https://avatars.githubusercontent.com/u/120456261?v=4",
  "memberNickName" : "NickName1"
}
Table 2. response-headers
Name Description

Location

Location header. 등록된 리소스의 URI

1.2. 회원 정보 수정

curl-request
$ curl 'http://localhost:8080/members/1' -i -X PATCH \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -H 'Authorization: WishJWT eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJVU0VSIl0sIm1lbWJlckVtYWlsIjoidGVzdDFAZ21haWwuY29tIiwic3ViIjoidGVzdDFAZ21haWwuY29tIiwiaWF0IjoxNjgxODIxOTEwLCJleHAiOjE2ODE4MjM3MTB9.h_V93dhS-RhzqVdYuRkxHHIxYjG61LSn87a_8HtpBgM' \
    -H 'Accept: application/json' \
    -d '{
  "memberId" : 1,
  "memberNickName" : "changedNickName222",
  "password" : "changedPW222"
}'
http-request
PATCH /members/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: WishJWT eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJVU0VSIl0sIm1lbWJlckVtYWlsIjoidGVzdDFAZ21haWwuY29tIiwic3ViIjoidGVzdDFAZ21haWwuY29tIiwiaWF0IjoxNjgxODIxOTEwLCJleHAiOjE2ODE4MjM3MTB9.h_V93dhS-RhzqVdYuRkxHHIxYjG61LSn87a_8HtpBgM
Accept: application/json
Content-Length: 98
Host: localhost:8080

{
  "memberId" : 1,
  "memberNickName" : "changedNickName222",
  "password" : "changedPW222"
}
Table 3. /members/{member-id}
Parameter Description

member-id

회원 식별자

Table 4. request-fields
Path Type Description

memberNickName

String

닉네임

password

String

비밀번호

http-response
HTTP/1.1 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 175

{
  "memberId" : 1,
  "email" : "[email protected]",
  "profileImage" : "https://avatars.githubusercontent.com/u/120456261?v=4",
  "memberNickName" : "changedNickName222"
}
Table 5. response-fields
Path Type Description

memberId

Number

회원 식별자

email

String

이메일

profileImage

String

프로필 이미지

memberNickName

String

닉네임

1.3. 회원 정보 조회

curl-request
$ curl 'http://localhost:8080/members/1' -i -X GET \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -H 'Accept: application/json'
http-request
GET /members/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: application/json
Host: localhost:8080
Table 6. /members/{member-id}
Parameter Description

member-id

회원 식별자

http-response
HTTP/1.1 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 166

{
  "memberId" : 1,
  "email" : "[email protected]",
  "profileImage" : "https://avatars.githubusercontent.com/u/120456261?v=4",
  "memberNickName" : "NickName1"
}
Table 7. response-fields
Path Type Description

memberId

Number

회원 식별자

email

String

이메일

profileImage

String

스탬프 갯수

memberNickName

String

닉네임

1.4. 회원 리스트 조회

curl-request
$ curl 'http://localhost:8080/members?page=1&size=10' -i -X GET \
    -H 'Accept: application/json'
http-request
GET /members?page=1&size=10 HTTP/1.1
Accept: application/json
Host: localhost:8080
Table 8. request-parameters
Parameter Description

page

페이지 수

size

페이지 당 Member 갯수

http-response
HTTP/1.1 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Length: 482

{
  "data" : [ {
    "memberId" : 1,
    "email" : "[email protected]",
    "profileImage" : "https://avatars.githubusercontent.com/u/120456261?v=4",
    "memberNickName" : "NickName1"
  }, {
    "memberId" : 2,
    "email" : "[email protected]",
    "profileImage" : "https://avatars.githubusercontent.com/u/120456261?v=4",
    "memberNickName" : "NickName2"
  } ],
  "pageInfo" : {
    "page" : 1,
    "size" : 10,
    "totalElements" : 2,
    "totalPages" : 1
  }
}
Table 9. response-fields
Path Type Description

data

Array

결과 데이터

data[].memberId

Number

회원 식별자

data[].email

String

이메일

data[].profileImage

String

프로필 이미지

data[].memberNickName

String

닉네임

pageInfo

Object

페이지 정보

pageInfo.page

Number

페이지 수

pageInfo.size

Number

한 페이지의 갯수

pageInfo.totalElements

Number

총 원소

pageInfo.totalPages

Number

총 페이지 수

1.5. 회원 삭제

curl-request
$ curl 'http://localhost:8080/members/1' -i -X DELETE \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -H 'Authorization: WishJWT eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJVU0VSIl0sIm1lbWJlckVtYWlsIjoidGVzdDFAZ21haWwuY29tIiwic3ViIjoidGVzdDFAZ21haWwuY29tIiwiaWF0IjoxNjgxODIxOTEwLCJleHAiOjE2ODE4MjM3MTB9.h_V93dhS-RhzqVdYuRkxHHIxYjG61LSn87a_8HtpBgM' \
    -H 'Accept: application/json'
http-request
DELETE /members/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: WishJWT eyJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJVU0VSIl0sIm1lbWJlckVtYWlsIjoidGVzdDFAZ21haWwuY29tIiwic3ViIjoidGVzdDFAZ21haWwuY29tIiwiaWF0IjoxNjgxODIxOTEwLCJleHAiOjE2ODE4MjM3MTB9.h_V93dhS-RhzqVdYuRkxHHIxYjG61LSn87a_8HtpBgM
Accept: application/json
Host: localhost:8080
Table 10. /members/{member-id}
Parameter Description

member-id

회원 식별자

http-response
HTTP/1.1 204 No Content
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Version 0.0.1-SNAPSHOT
Last updated 2023-04-19 04:40:05 +0900