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://https://just-pickup.com:8000/notifications' -i -X GET \
    -H 'user-id: 1'

HTTP request

GET //just-pickup.com:8000/notifications HTTP/1.1
user-id: 1
Host: https

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : {
    "notifications" : [ {
      "id" : 1,
      "message" : "1번 메시지 예시입니다.",
      "title" : "제목1",
      "read" : true,
      "time" : "2022-03-25 17:56"
    }, {
      "id" : 2,
      "message" : "2번 메시지 예시입니다.",
      "title" : "제목2",
      "read" : true,
      "time" : "2022-03-25 17:56"
    }, {
      "id" : 3,
      "message" : "3번 메시지 예시입니다.",
      "title" : "제목3",
      "read" : true,
      "time" : "2022-03-25 17:56"
    }, {
      "id" : 4,
      "message" : "4번 메시지 예시입니다.",
      "title" : "제목4",
      "read" : true,
      "time" : "2022-03-25 17:56"
    }, {
      "id" : 5,
      "message" : "5번 메시지 예시입니다.",
      "title" : "제목5",
      "read" : true,
      "time" : "2022-03-25 17:56"
    }, {
      "id" : 6,
      "message" : "6번 메시지 예시입니다.",
      "title" : "제목6",
      "read" : false,
      "time" : "2022-03-25 17:56"
    }, {
      "id" : 7,
      "message" : "7번 메시지 예시입니다.",
      "title" : "제목7",
      "read" : false,
      "time" : "2022-03-25 17:56"
    }, {
      "id" : 8,
      "message" : "8번 메시지 예시입니다.",
      "title" : "제목8",
      "read" : false,
      "time" : "2022-03-25 17:56"
    }, {
      "id" : 9,
      "message" : "9번 메시지 예시입니다.",
      "title" : "제목9",
      "read" : false,
      "time" : "2022-03-25 17:56"
    }, {
      "id" : 10,
      "message" : "10번 메시지 예시입니다.",
      "title" : "제목10",
      "read" : false,
      "time" : "2022-03-25 17:56"
    } ]
  }
}

Request headers

Name Description

user-id

회원 고유번호

Response fields

Path Type Description

code

String

결과코드 SUCCESS/ERROR

message

String

메시지

data.notifications[*].id

Number

알림 고유번호

data.notifications[*].message

String

알림 내용

data.notifications[*].title

String

알림 제목

data.notifications[*].read

Boolean

알림 읽음 여부

data.notifications[*].time

String

알림 생성 시간 [YYYY-MM-DD HH:MM]

알림 수정

Curl request

$ curl 'http://https://just-pickup.com:8000/notification/1' -i -X PATCH \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -H 'Accept: application/json' \
    -d '{
  "read" : true
}'

HTTP request

PATCH //just-pickup.com:8000/notification/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: application/json
Content-Length: 19
Host: https

{
  "read" : true
}

HTTP response

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

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

Path parameters

Table 1. /notification/{notificationId}
Parameter Description

notificationId

알림 고유번호

Request fields

Path Type Description

read

Boolean

읽음 여부

Response fields

Path Type Description

code

String

결과코드 SUCCESS/ERROR

message

String

메시지

data

Null

데이터

API

읽지 않은 알림 개수 조회

Curl request

$ curl 'http://https://just-pickup.com:8000/api/notification/counts' -i -X GET \
    -H 'user-id: 1'

HTTP request

GET //just-pickup.com:8000/api/notification/counts HTTP/1.1
user-id: 1
Host: https

HTTP response

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

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

Request headers

Name Description

user-id

회원 고유번호

Response fields

Path Type Description

code

String

결과코드 SUCCESS/ERROR

message

String

메시지

data

Number

알림 개수