상품 상태 변경
v1 API 상세: 상품
상품의 상태 값만 바꿉니다. 전시 상태, 판매 여부, 재고 수량, 타임 세일 같은 값이 대상입니다.
API 엔드포인트
요청 파라미터
요청 파라미터
| 파라미터 | 타입 | 필수 | 설명 |
|---|---|---|---|
| product_id | String | Y | 상품 고유 번호 (URL 파라미터) |
| status_display | Boolean | N | 쇼핑몰 전시 여부 |
| status_sale | Boolean | N | 판매 중 여부 |
| status_frozen | Boolean | N | 판매금지 상태. 한 번 true 로 바꾸면 API 로 되돌릴 수 없습니다 (이후 요청은 PRODUCT_FROZEN) |
| status_review | String | N | 심사 상태 (auto_confirm·waiting·pending·confirm·reject) |
| use_display_period | Boolean | N | 전시 기간 사용 여부 |
| display_start_at | String | N | 전시 시작일 |
| display_end_at | String | N | 전시 종료일 |
| use_sale_period | Boolean | N | 판매 기간 사용 여부 |
| sale_start_at | String | N | 판매 시작일 |
| sale_end_at | String | N | 판매 종료일 |
| use_discount_period | Boolean | N | 할인 기간 사용 여부 |
| discount_start_at | String | N | 할인 시작일 |
| discount_end_at | String | N | 할인 종료일 |
| status_time_sale | Boolean | N | 타임 세일 사용 여부 |
| time_sale_start_at | String | N | 타임 세일 시작일 |
| time_sale_end_at | String | N | 타임 세일 종료일 |
| time_sale_discount_percent | Integer | N | 타임 세일 할인율 (정수로 저장됩니다 — 소수점은 버립니다) |
| use_stock | Boolean | N | 재고 관리 여부 |
| stock | Integer | N | 남은 재고 수량 |
| stock_safe | Integer | N | 안전 재고 임계값 |
| use_stock_safe | Boolean | N | 안전 재고 관리 여부 |
| use_option_stock | Boolean | N | 옵션별 재고 관리 여부 |
코드 예제
curl -X PUT "https://api.bootapi.com/v1/products/67e4b4425ec892162491d0ec/status" \
-H "Authorization: Basic {base64(client_key:secret_key)}" \
-H "Content-Type: application/json" \
-d '{
"status_display": true,
"status_sale": true,
"use_stock": true,
"stock": 50
}'import { BootpayCommerce } from '@bootpay/backend-js';
const commerce = new BootpayCommerce({
client_key: '{client_key}',
secret_key: '{secret_key}'
});
const response = await commerce.product.status({
product_id: '67e4b4425ec892162491d0ec',
status_display: true,
status_sale: true,
use_stock: true,
stock: 50
});
console.log(response);from bootpay_backend.commerce import BootpayCommerce
commerce = BootpayCommerce('{client_key}', '{secret_key}')
response = commerce.product.status({
'product_id': '67e4b4425ec892162491d0ec',
'status_display': True,
'status_sale': True,
'use_stock': True,
'stock': 50
})
print(response)use Bootpay\ServerPhp\BootpayCommerceApi;
$commerce = new BootpayCommerceApi("your-commerce-client-key", "your-commerce-secret-key");
$response = $commerce->product->status([
'product_id' => '67e4b4425ec892162491d0ec',
'status_display' => true,
'status_sale' => true,
'use_stock' => true,
'stock' => 50
]);
print_r($response);import kr.co.bootpay.store.BootpayStore;
import kr.co.bootpay.store.model.request.TokenPayload;
import kr.co.bootpay.store.model.request.product.ProductStatusParams;
import kr.co.bootpay.store.model.response.BootpayStoreResponse;
TokenPayload tokenPayload = new TokenPayload("{client_key}", "{secret_key}");
BootpayStore bootpay = new BootpayStore(tokenPayload).withToken();
ProductStatusParams params = new ProductStatusParams();
params.productId = "67e4b4425ec892162491d0ec";
params.statusDisplay = true;
params.statusSale = true;
params.useStock = true;
params.stock = 50;
BootpayStoreResponse response = bootpay.product.status(params);
System.out.println(response.getData());require 'bootpay'
commerce = BootpayStore::RestClient.new(client_key: '{client_key}', secret_key: '{secret_key}')
response = commerce.product_status(
product_id: '67e4b4425ec892162491d0ec',
status_display: true,
status_sale: true,
use_stock: true,
stock: 50
)
puts response.dataimport "github.com/bootpay/backend-go/v2"
commerce := bootpay.NewCommerceAPI("your-commerce-client-key", "your-commerce-secret-key", nil, "production")
// Go SDK 의 ProductStatusParams 는 status 를 항상 보내고 재고 칸이 없어 범용 Put 으로 보냅니다
response, err := commerce.Put("products/67e4b4425ec892162491d0ec/status", map[string]interface{}{
"status_display": true,
"status_sale": true,
"use_stock": true,
"stock": 50,
})
fmt.Println(response, err)using Bootpay.Commerce;
using System.Net.Http;
var commerce = new BootpayCommerceApi("your-commerce-client-key", "your-commerce-secret-key");
// .NET SDK 의 ProductStatusParams 에는 재고 속성이 없어 SendAsync 로 보냅니다
var response = await commerce.SendAsync("products/67e4b4425ec892162491d0ec/status", HttpMethod.Put, new {
status_display = true,
status_sale = true,
use_stock = true,
stock = 50
});
Console.WriteLine(await response.Content.ReadAsStringAsync());응답
성공 응답
HTTP 200 에 본문은 null 입니다.
JSON
null에러 응답
HTTP/1.1 404 Not Found
Content-Type: application/jsonJSON
{
"error_code": "PRODUCT_NOT_FOUND",
"message": "존재하지 않는 상품입니다"
}에러 코드
오류 코드
| 코드 | 메시지 | 대처 방법 |
|---|---|---|
PRODUCT_NOT_FOUND | 존재하지 않는 상품입니다 | product_id를 확인합니다 |
PRODUCT_FROZEN | 판매금지된 상품은 편집/저장 안됩니다. 관리자에게 문의 바랍니다 | 관리자에게 문의합니다 |