작물 종류 조회

HTTP request

GET /projects/crop-types HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: application/json
Host: localhost:8080

Response fields

Path Type Description

success

Boolean

요청 성공 여부

data

Array

프로젝트 작물 종류

Example response

HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
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: 303

{
  "success" : true,
  "data" : [ "팥", "참께", "콩", "가지", "감자", "고추", "단호박", "들깨", "딸기", "무", "배", "배추", "벼", "사과", "상추", "수박", "애호박", "양배추", "오이", "옥수수", "쥬키니호박", "참외", "토마토", "파", "포도", "호박" ]
}

프로젝트 생성

Request fields

Path Type Description

name

String

프로젝트 이름

cropType

String

프로젝트에서 관리할 작물 종류

startDate

String

프로젝트 시작 날짜

endDate

String

프로젝트 종료 예상 날짜

HTTP request

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

{
  "name" : "테스트 프로젝트",
  "startDate" : "2022-03-01",
  "endDate" : "2022-12-01",
  "cropType" : "팥"
}

Response headers

Name Description

Location

생성된 프로젝트 조회 요청

Response fields

Path Type Description

success

Boolean

요청 성공 여부

data

Number

생성된 프로젝트 아이디

Example response

HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: http://localhost:8080/projects/3
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: 36

{
  "success" : true,
  "data" : 3
}

프로젝트 수정

Path parameters

Table 1. /projects/{projectId}
Parameter Description

projectId

수정하려는 프로젝트 아이디

Request fields

Path Type Description

name

String

프로젝트 이름

cropType

String

프로젝트에서 관리하는 작물 종류

startDate

Null

프로젝트 시작 날짜

endDate

Null

프로젝트 종료 날짜

completed

Boolean

프로젝트 완료 여부

HTTP request

PUT /projects/2 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: application/json
Content-Length: 126
Host: localhost:8080

{
  "name" : "수정 프로젝트",
  "startDate" : null,
  "endDate" : null,
  "cropType" : "가지",
  "completed" : false
}

Response headers

Name Description

Location

수정된 프로젝트 조회 요청

Response fields

Path Type Description

success

Boolean

요청 성공 여부

data

Number

수정된 프로젝트 아이디

Example response

HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: http://localhost:8080/projects/2
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: 36

{
  "success" : true,
  "data" : 2
}

프로젝트 조회

Path parameters

Table 1. /projects/{projectId}
Parameter Description

projectId

조회하려는 프로젝트 아이디

HTTP request

GET /projects/4 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: application/json
Host: localhost:8080

Response fields

Path Type Description

success

Boolean

요청 성공 여부

data

Object

조회한 프로젝트 데이터

data.projectId

Number

프로젝트 아이디

data.name

String

프로젝트 이름

data.cropType

String

프로젝트에서 관리하는 작물 종류

data.startDate

String

프로젝트에 설정한 시작 날짜

data.endDate

String

프로젝트에 설정한 종료 날짜

data.completed

Boolean

프로젝트 완료 여부

Example response

HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
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: 210

{
  "success" : true,
  "data" : {
    "projectId" : 4,
    "name" : "테스트 프로젝트",
    "cropType" : "팥",
    "startDate" : "2022-03-01",
    "endDate" : "2022-12-01",
    "completed" : false
  }
}

프로젝트 리스트 조회

Request parameters

Parameter Description

page

요청하려는 페이지 인덱스. default=0

size

요청하려는 페이지 내 컨텐츠 크기. default=10, max=100

HTTP request

GET /projects?page=0&size=10 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: application/json
Host: localhost:8080

Response fields

Path Type Description

success

Boolean

요청 성공 여부

data

Object

응답된 페이지

data.content

Array

응답된 페이지 내용. Project 조회 응답과 동일.

data.number

Number

페이지 넘버

Example response

HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
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: 2397

{
  "success" : true,
  "data" : {
    "content" : [ {
      "projectId" : 24,
      "name" : "test project-19",
      "cropType" : "옥수수",
      "startDate" : "2022-09-07",
      "endDate" : "2022-05-25",
      "completed" : false
    }, {
      "projectId" : 23,
      "name" : "test project-18",
      "cropType" : "오이",
      "startDate" : "2022-08-28",
      "endDate" : "2022-06-04",
      "completed" : true
    }, {
      "projectId" : 22,
      "name" : "test project-17",
      "cropType" : "양배추",
      "startDate" : "2022-08-18",
      "endDate" : "2022-06-14",
      "completed" : false
    }, {
      "projectId" : 21,
      "name" : "test project-16",
      "cropType" : "애호박",
      "startDate" : "2022-08-08",
      "endDate" : "2022-06-24",
      "completed" : true
    }, {
      "projectId" : 20,
      "name" : "test project-15",
      "cropType" : "수박",
      "startDate" : "2022-07-29",
      "endDate" : "2022-07-04",
      "completed" : false
    }, {
      "projectId" : 19,
      "name" : "test project-14",
      "cropType" : "상추",
      "startDate" : "2022-07-19",
      "endDate" : "2022-07-14",
      "completed" : true
    }, {
      "projectId" : 18,
      "name" : "test project-13",
      "cropType" : "사과",
      "startDate" : "2022-07-09",
      "endDate" : "2022-07-24",
      "completed" : false
    }, {
      "projectId" : 17,
      "name" : "test project-12",
      "cropType" : "벼",
      "startDate" : "2022-06-29",
      "endDate" : "2022-08-03",
      "completed" : true
    }, {
      "projectId" : 16,
      "name" : "test project-11",
      "cropType" : "배추",
      "startDate" : "2022-06-19",
      "endDate" : "2022-08-13",
      "completed" : false
    }, {
      "projectId" : 15,
      "name" : "test project-10",
      "cropType" : "배",
      "startDate" : "2022-06-09",
      "endDate" : "2022-08-23",
      "completed" : true
    } ],
    "pageable" : {
      "sort" : {
        "unsorted" : false,
        "sorted" : true,
        "empty" : false
      },
      "pageNumber" : 0,
      "pageSize" : 10,
      "offset" : 0,
      "paged" : true,
      "unpaged" : false
    },
    "numberOfElements" : 10,
    "size" : 10,
    "number" : 0,
    "sort" : {
      "unsorted" : false,
      "sorted" : true,
      "empty" : false
    },
    "first" : true,
    "last" : false,
    "empty" : false
  }
}

프로젝트 완료 여부 수정

Request parameters

Parameter Description

completed

프로젝트 완료 여부

HTTP request

PUT /projects/1/completed HTTP/1.1
Accept: application/json
Host: localhost:8080
Content-Type: application/x-www-form-urlencoded

completed=true

Response headers

Name Description

Location

수정된 프로젝트 요청

Response fields

Path Type Description

success

Boolean

요청 성공 여부

data

Number

수정된 프로젝트 아이디

Example response

HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: http://localhost:8080/projects/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: 36

{
  "success" : true,
  "data" : 1
}