HTTP 동사

본 REST API에서 사용하는 HTTP 동사(verbs)는 가능한한 표준 HTTP와 REST 규약을 따릅니다.

동사 용례

GET

리소스를 가져올 때 사용

POST

새 리소스를 만들 때 사용

PUT

기존 리소스를 수정할 때 사용

PATCH

기존 리소스의 일부를 수정할 때 사용

DELETE

기존 리소스를 삭제할 떄 사용

HTTP 상태 코드

본 REST API에서 사용하는 HTTP 상태 코드는 가능한 표준 HTTP와 REST 규약을 따릅니다.

상태 코드 용례

200 OK

요청을 성공적으로 처리함

201 Created

새 리소스를 성공적으로 생성함. 응답의 Location 헤더에 해당 리소스의 URI가 담겨있다.

204 No Content

기존 리소스를 성공적으로 수정함.

400 Bad Request

잘못된 요청을 보낸 경우. 응답 본문에 더 오류에 대한 정보가 담겨있다.

404 Not Found

요청한 리소스가 없음.

409 Conflict

클라이언트의 요청이 서버의 상태와 충돌이 발생한 경우.

유저

로그인 된 회원 조회

Curl request

$ curl 'http://127.0.0.1:8001/customer/' -i -X GET \
    -H 'user-id: 1'

HTTP request

GET /customer/ HTTP/1.1
user-id: 1
Host: 127.0.0.1:8001

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : {
    "userId" : 1,
    "email" : "hoonasdasd@naver.com",
    "userName" : "이름",
    "phoneNumber" : "010-1234-5678"
  }
}

Request headers

Name Description

user-id

로그인한 유저 id

Response fields

Path Type Description

code

String

결과코드 SUCCESS/ERROR

message

String

메시지

data.userId

Number

회원 고유번호

data.userName

String

회원 이름

data.email

String

회원 이메일

data.phoneNumber

String

회원 휴대폰 번호

회원 조회

Curl request

$ curl 'http://127.0.0.1:8001/customer/1' -i -X GET

HTTP request

GET /customer/1 HTTP/1.1
Host: 127.0.0.1:8001

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : {
    "userId" : 1,
    "userName" : "이름",
    "phoneNumber" : "010-1234-5678"
  }
}

Path parameters

Table 1. /customer/{userId}
Parameter Description

userId

회원 고유번호

Response fields

Path Type Description

code

String

결과코드 SUCCESS/ERROR

message

String

메시지

data.userId

Number

회원 고유번호

data.userName

String

회원 이름

data.phoneNumber

String

회원 휴대폰 번호

회원 조회 (존재하지 않는 회원)

Curl request

$ curl 'http://127.0.0.1:8001/customer/9999' -i -X GET

HTTP request

GET /customer/9999 HTTP/1.1
Host: 127.0.0.1:8001

HTTP response

HTTP/1.1 409 Conflict
Content-Type: application/json
Content-Length: 94

{
  "code" : "ERROR",
  "message" : "존재하지 않는 회원 입니다.",
  "data" : null
}

Path parameters

Table 1. /customer/{userId}
Parameter Description

userId

회원 고유번호

Response fields

Path Type Description

code

String

결과코드 SUCCESS/ERROR

message

String

메시지

data

Null

데이터

회원 조회

Curl request

$ curl 'http://127.0.0.1:8001/customers/1,2,3' -i -X GET

HTTP request

GET /customers/1,2,3 HTTP/1.1
Host: 127.0.0.1:8001

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : [ {
    "userId" : 1,
    "userName" : "이름1",
    "phoneNumber" : "010-1234-5678"
  }, {
    "userId" : 2,
    "userName" : "이름2",
    "phoneNumber" : "010-1234-5678"
  }, {
    "userId" : 3,
    "userName" : "이름3",
    "phoneNumber" : "010-1234-5678"
  } ]
}

Path parameters

Table 1. /customers/{customerIds}
Parameter Description

customerIds

회원 고유 번호들

Response fields

Path Type Description

code

String

결과 코드 SUCCESS/ERROR

message

String

메시지

data[*].userId

Number

회원 고유 번호

data[*].userName

String

회원 이름

data[*].phoneNumber

String

회원 전화번호

점주

회원가입 - 점주

Curl request

$ curl 'http://admin.just-pickup.com:8001/api/owner/store-owner' -i -X POST \
    -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -d '{
  "email" : "test@gmail.com",
  "password" : "1234",
  "name" : "테스트 이름",
  "phoneNumber" : "010-1234-5678",
  "businessNumber" : "03124",
  "storeName" : "테스트 매장",
  "storePhoneNumber" : "010-1234-5678",
  "address" : "충북 청주시 서원구 1순환로 627",
  "zipcode" : "28562",
  "latitude" : 36.6375346629654,
  "longitude" : 127.459726819858
}'

HTTP request

POST /api/owner/store-owner HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 376
Host: admin.just-pickup.com:8001

{
  "email" : "test@gmail.com",
  "password" : "1234",
  "name" : "테스트 이름",
  "phoneNumber" : "010-1234-5678",
  "businessNumber" : "03124",
  "storeName" : "테스트 매장",
  "storePhoneNumber" : "010-1234-5678",
  "address" : "충북 청주시 서원구 1순환로 627",
  "zipcode" : "28562",
  "latitude" : 36.6375346629654,
  "longitude" : 127.459726819858
}

HTTP response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 59

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : null
}

Request fields

Path Type Description

email

String

이메일

password

String

비밀번호

name

String

이름

phoneNumber

String

핸드폰 번호

businessNumber

String

사업자번호

storeName

String

매장 이름

storePhoneNumber

String

매장 번호

address

String

매장 주소

zipcode

String

매장 우편번호

latitude

Number

위도

longitude

Number

경도