상품 API - Soobinnn/CAT-24 GitHub Wiki

상품 API

쇼핑몰에서 판매되는 물건이나 서비스를 의미합니다. 상품은 다양한 색 또는 사이즈의 옵션을 통해 품목으로 나눠질 수 있습니다.

Products Properties

Attribute Description
product_no 상품분류
product_code 상품코드
custom_product_code 자체상품분류
product_name 상품명
model_name 모델명
cost_price 원가
selling_price 판매가
summary 요약설명
detail 설명
product_image 상품 이미지
product_subimage 추가 이미지
sell_yn 판매중여부
discount_yn 할인여부
reg_id 등록자
reg_Date 등록일자
category_no 카테고리 분류

Admin API

EndPoints

- 상품 전체 목록

Definition

GET /api/v1/admin/products/

- Request Example

	curl -X 'GET' /api/v1/admin/products/
             -H 'content-type: application/json' \
             -H 'X-Api-Version: {version}'

- Response Example

{
	"data": [ {
    "product_no" : 1,
    "product_code" : "code1",
    "custom_product_code" : "custom1",
    "product_name" : "캣타워",
    "model_name" : "cattower01",
    "cost_price" : 110000.0,
    "selling_price" : 330000.0,
    "summary" : "고양이들이 좋아하는 캣타워",
    "detail" : "고양이들이 좋아하는 캣타워 인기만점 1234567890",
    "product_image" : null,
    "product_subimage" : null,
    "sell_yn" : "N",
    "discount_yn" : "N",
    "reg_id" : null,
    "reg_Date" : "2019-08-03",
    "category_no" : 1
  } ]
}

- 상품 전체 갯수

Definition

GET /api/v1/admin/products/count

- Request Example

	curl -X 'GET' /api/v1/admin/products/count
             -H 'content-type: application/json' \
             -H 'X-Api-Version: {version}'

- Response Example

{
    "data": {
             "count" : 10
            }
}

- 해당 상품 조회

Definition

GET /api/v1/admin/products/{product_no}

- Request Example

	curl -X 'GET' /api/v1/admin/products/1
             -H 'content-type: application/json' \
             -H 'X-Api-Version: {version}'

- Response Example

{
	"data": {
                  "product_no" : 1,
                  "product_code" : "code1",
                  "custom_product_code" : "custom1",
                  "product_name" : "캣타워",
                  "model_name" : "cattower01",
                  "cost_price" : 110000.0,
                  "selling_price" : 330000.0,
                  "summary" : "고양이들이 좋아하는 캣타워",
                  "detail" : "고양이들이 좋아하는 캣타워 인기만점 1234567890",
                  "product_image" : /cattower1.jpg,
                  "product_subimage" : /cattower2.jpg,
                  "sell_yn" : "N",
                  "discount_yn" : "N",
                  "reg_id" : null,
                  "reg_Date" : "2019-08-03",
                  "category_no" : 1
                }
}

- 상품 등록

Definition

POST /api/v1/admin/products/

- Request Example

	curl -X ' POST' /api/v1/admin/products/
             -H 'content-type: application/json' \
             -H 'X-Api-Version: {version}'
             -D { 
                  "product_code" : "code1",
                  "custom_product_code" : "custom1",
                  "product_name" : "캣타워",
                  "model_name" : "cattower01",
                  "cost_price" : 110000.0, 
                  "selling_price" : 330000.0,
                  "summary" : "고양이들이 좋아하는 캣타워",
                  "detail" : "고양이들이 좋아하는 캣타워 인기만점 1234567890",
                  "product_image" : /cattower1.jpg,
                  "product_subimage" : /cattower2.jpg,
                  "sell_yn" : "N",
                  "discount_yn" : "N",
                  "category_no" : 1
                }

- Response Example

 {
	"result" : "success",
        "message" : null,
        "data" : "success"
}

- 해당 상품 삭제

Definition

DELETE /api/v1/admin/products/{product_no}

- Request Example

	curl -X ' DELETE' /api/v1/admin/products/1 
             -H 'content-type: application/json' \
             -H 'X-Api-Version: {version}'

- Response Example

 {
	"result" : "success",
        "message" : null,
        "data" : "success"
}

- 해당 상품 수정

Definition

PUT /api/v1/admin/products/{product_no}

- Request Example

	curl -X ' PUT' /api/v1/admin/products/1
             -H 'content-type: application/json' \
             -H 'X-Api-Version: {version}'
             -D { 
                  "product_code" : "code1",
                  "custom_product_code" : "custom1",
                  "product_name" : "캣타워",
                  "model_name" : "cattower01",
                  "cost_price" : 110000.0, 
                  "selling_price" : 330000.0,
                  "summary" : "고양이들이 좋아하는 캣타워",
                  "detail" : "고양이들이 좋아하는 캣타워 인기만점 1234567890",
                  "product_image" : /cattower1.jpg,
                  "product_subimage" : /cattower2.jpg,
                  "sell_yn" : "N",
                  "discount_yn" : "N",
                  "category_no" : 1
                }

- Response Example

 {
	"result" : "success",
        "message" : null,
        "data" : "success"
}