/
[API 리뷰] 상품 리스트, 조회

[API 리뷰] 상품 리스트, 조회

 

Schema

  • product

  • siteProduct

API

  • 상품 리스트

  • 상품 조회

 

Postman collection

Schema, API 리뷰 (상품 리스트, 조회).postman_collection.json

상품 리스트

  • apiType : service

  • 카테고리 별 상품 리스트

GET {{protocol}}://{{hostname}}:{{port}}/svc/product/list

{ "typeId": "api", "category": "product", "apiId": "list", "apiName": "Product List", "apiType": "service", "method": "GET", "parameters": [ { "parameter": "categoryId", "name": "카테고리아이디", "valueType": "STRING", "required": false }, { "parameter": "priceRange", "name": "가격 범위", "valueType": "STRING", "required": false }, { "parameter": "brand", "name": "브랜드", "valueType": "STRING", "required": false }, { "parameter": "filter", "name": "검색필터", "valueType": "STRING", "required": false } ], "statistic": true, "aggregation": false, "root": { "configId": "root", "tid": "siteProduct", "type": "query", "allowParams": false, "orderNo": 1, "cacheable": false, "cacheTime": 60, "customResponse": "productListResponse", "query": [ { "method": "matching", "field": "site", "value": "{{:_siteId}}" }, { "method": "matching", "field": "approvalStatus", "value": "approval" }, { "method": "matching", "field": "saleStatus", "value": "selling" }, { "method": "matching", "field": "exposure", "value": "true" }, { "method": "matching", "field": "deleted", "value": "false" }, { "method": "sorting", "value": "{{:sorting}},id desc" }, { "method": "page", "value": "{{:page}}" }, { "method": "pageSize", "value": "{{:pageSize}}" }, { "method": "matching", "field": "siteCategoriesIdPath", "value": "{{:categoryId}}" }, { "method": "fromto", "field": "siteProductSaleInfo.{{:decode(_deviceType,'mobile','discountSalePriceMobile','discountSalePrice')}}", "value": "{{:priceRange}}" }, { "method": "matching", "field": "baseProduct.productDetail.brand", "value": "{{:brand}}" }, { "method": "referenceJoin", "field": "baseProduct", "value": "{{:getQueryString(filter,'matching','productAttrValues')}}" } ], "response": [ { "field": "id", "type": "field", "value": "" }, { "field": "name", "type": "field", "value": "" }, { "field": "siteCategories", "type": "field", "value": "" }, { "field": "siteProductSaleInfo", "type": "field", "value": "" }, { "field": "images", "type": "field", "value": "baseProduct.images" }, { "field": "created", "type": "field", "value": "baseProduct.created" } ] } }
@Component("productListResponse") public class ProductListResponse implements CustomResponse { @Override public List<QueryResult> execute(QueryContext queryContext, List<QueryResult> subList) { if (subList.size() == 0) return subList; for (QueryResult result : subList) { if (result.get("siteProduct") != null) { Reference reference = (Reference) result.get("siteProduct"); String id = (String) reference.getValue(); SaleStatus saleStatus = new SaleStatus(id); result.put("saleStatus", saleStatus.getStatus()); result.put("id", id); result.remove("siteProduct"); } if (result.get("images") == null) { continue; } List<Map<String, Object>> images = (List<Map<String, Object>>) result.get("images"); for (Map<String, Object> image : images) { if (image.get("imageType") == null) { continue; } Code imageType = (Code) image.get("imageType"); if (StringUtils.equals(String.valueOf(imageType.getValue()), "representative")) { result.put("image", image.get("file")); result.remove("images"); } } } return subList; } @Override public Map<String, Object> execute(ReadContext readContext, Map<String, Object> itemResult) { return itemResult; } }

 

Result

{ "result": "200", "resultMessage": "SUCCESS", "totalCount": 15, "resultCount": 15, "pageSize": 20, "pageCount": 1, "currentPage": 1, "items": [ { "id": 2032456031, "name": "윈도우핏 에어컨 (17 ㎡)", "siteCategories": [ { "value": "947", "label": "홈멀티 에어컨", "refId": "947" } ], "siteProductSaleInfo": { "id": "2144595594", "label": "", "supplyPrice": 679200, "salePrice": 849000, "useDiscount": false, "discountSalePrice": 849000, "discountSalePriceMobile": 849000, "stockQuantity": 999, "minOrderQuantity": 1, "maxOrderType": { "value": "unlimited", "label": "무제한" } }, "created": "2021-06-15 20:04:18", "image": "http://local.i-on.net:8080/productImage/file/202106/15/1c69743a-a108-4b7c-9a7a-70f22f89e54d.png/ed67de12-0d04-4d85-890e-fb4bcd900bb2.png" }, { "id": 1503873680, "name": "무풍에어컨 갤러리 (56.9 ㎡)", "siteCategories": [ { "value": "947", "label": "홈멀티 에어컨", "refId": "947" } ], "siteProductSaleInfo": { "id": "856353151", "label": "", "supplyPrice": 1719200, "salePrice": 2149000, "useDiscount": false, "discountSalePrice": 2149000, "discountSalePriceMobile": 2149000, "stockQuantity": 999, "minOrderQuantity": 1, "maxOrderType": { "value": "unlimited", "label": "무제한" } }, "created": "2021-06-15 20:04:17", "image": "http://local.i-on.net:8080/productImage/file/202106/15/ecf53fc2-1d5d-45a3-a557-c66706794c82.png/32e49215-68b4-4710-814c-466e5c4023d0.png" } ] }

 

 

 

상품 조회

  • apiType : service

  • 상품 상세 조회

GET {{protocol}}://{{hostname}}:{{port}}/svc/product/list

{ "typeId": "api", "category": "product", "apiId": "read", "apiName": "상품 조회", "apiType": "service", "method": "GET", "parameters": [ { "parameter": "productId", "name": "상품ID", "valueType": "STRING", "required": true } ], "statistic": true, "aggregation": false, "root": { "configId": "root", "tid": "siteProduct", "type": "query", "resultType": "OBJECT", "cacheable": false, "cacheTime": 1, "allowParams": false, "orderNo": 1, "customResponse": "productReadResponse", "query": [ { "method": "matching", "field": "id", "value": "{{:productId}}" }, { "method": "matching", "field": "approvalStatus", "value": "approval" }, { "method": "matching", "field": "saleStatus", "value": "selling" }, { "method": "matching", "field": "exposure", "value": "true" }, { "method": "matching", "field": "deleted", "value": "false" }, { "method": "matching", "field": "site", "value": "{{:_siteId}}" } ], "response": [ { "field": "id", "type": "field", "value": "" }, { "field": "name", "type": "field", "value": "" }, { "field": "siteProductSaleInfo", "type": "field", "value": "" }, { "field": "optionType", "type": "field", "value": "baseProduct.productOptionInfo.optionType" }, { "field": "productOptionCodes", "type": "field", "value": "baseProduct.productOptionInfo.productOptionCodes" }, { "field": "productOptions", "type": "field", "value": "baseProduct.productOptionInfo.productOptions" }, { "field": "productDetail", "type": "field", "value": "baseProduct.productDetail" }, { "field": "images", "type": "field", "value": "baseProduct.images" }, { "field": "videos", "type": "field", "value": "baseProduct.videos" } ] } }
@Component("productReadResponse") public class ProductReadResponse implements CustomResponse { @Autowired private ImageDisplayService imageDisplayService; @Override public List<QueryResult> execute(QueryContext queryContext, List<QueryResult> subList) { if (subList.size() == 0) return subList; QueryResult result = subList.get(0); imageDisplayService.setImages(queryContext, result); String id = JsonUtils.getStringValue(result, "id"); if (id == "") { id = JsonUtils.getStringValue(result, "siteProduct"); } SaleStatus saleStatus = new SaleStatus(id); result.put("saleStatus", saleStatus.getStatus()); subList.clear(); subList.add(result); return subList; } @Override public Map<String, Object> execute(ReadContext readContext, Map<String, Object> itemResult) { return itemResult; } }

 

Result

{ "result": "404", "resultMessage": "Not Found" }

 

{ "result": "200", "resultMessage": "SUCCESS", "item": { "id": 325583032, "name": "윈도우핏 에어컨 (17 ㎡)", "siteProductSaleInfo": { "id": "1812572150", "label": "", "supplyPrice": 679200, "salePrice": 849000, "useDiscount": false, "discountSalePrice": 849000, "discountSalePriceMobile": 849000, "stockQuantity": 999, "minOrderQuantity": 1, "maxOrderType": { "value": "unlimited", "label": "무제한" } }, "optionType": { "value": "none", "label": "없음" }, "productOptionCodes": null, "productOptions": null, "productDetail": { "id": "9192324", "label": "", "manufactureDate": "2020-01-01 00:00:00", "taxType": { "value": "tax", "label": "과세" }, "minorPurchasable": false, "selfMadeProduct": false, "manufacturer": { "value": "102", "label": "삼성전자", "refId": "102" }, "brand": { "value": "SAMSUNG", "label": "SAMSUNG", "refId": "SAMSUNG" }, "model": "SS001", "originArea": "한국", "afterServiceInfo": null, "productCertificationInfo": null, "productInfoType": null }, "images": [ { "id": "9192324", "label": "", "name": null, "imageType": { "value": "representative", "label": "대표이미지" }, "file": "http://local.i-on.net:8080/productImage/file/202106/16/0210ae05-a37c-43e9-92a3-aec911a08c13.png/fileed67de12-0d04-4d85-890e-fb4bcd900bb2.png", "fileSize": null, "width": null, "height": null }, { "id": "91923241", "label": "", "name": null, "imageType": { "value": "optional", "label": "추가이미지" }, "file": "http://local.i-on.net:8080/productImage/file/202106/16/4d500f14-ddbe-4d78-9808-3d316f913988.png/fileed67de12-0d04-4d85-890e-fb4bcd900bb2.png", "fileSize": null, "width": null, "height": null } ], "videos": null, "thumbnailImages": [], "detailImages": [], "saleStatus": null } }

 

 

 

Related content