조회 — 창고와 위치
“창고와 위치”의 데이터를 조회합니다. 결과는 이 작업의 매개변수에 따라 달라집니다.
GET/api/v1/inventory/warehouses/{warehouse_id}
- 인증
Bearer- 최소 요금제
- STANDARD
- 필수 권한
inventory.stock:read
코드 예제
요청 예제
cURL
: "${SHOPENTLY_SHOP_URL:?}"
curl --disable --globoff --fail-with-body --silent --show-error \
--proto '=https' --connect-timeout 5 --max-time 30 \
--request GET \
--header "Authorization: Bearer ${SHOPENTLY_ACCESS_TOKEN:?}" \
--url "${SHOPENTLY_SHOP_URL%/}"/api/v1/inventory/warehouses/example
PHP
<?php
declare(strict_types=1);
$baseUrl = rtrim(getenv('SHOPENTLY_SHOP_URL') ?: '', '/');
$origin = parse_url($baseUrl);
if (!$origin || ($origin['scheme'] ?? '') !== 'https' || empty($origin['host']) ||
isset($origin['user'], $origin['pass']) || isset($origin['user']) || isset($origin['path']) ||
isset($origin['query']) || isset($origin['fragment'])) {
throw new RuntimeException('SHOPENTLY_SHOP_URL must be an HTTPS origin');
}
$credential = getenv('SHOPENTLY_ACCESS_TOKEN') ?: '';
if ($credential === '' || strpbrk($credential, "\r\n") !== false) {
throw new RuntimeException('Invalid credential');
}
$headers = [];
$headers[] = 'Authorization: Bearer ' . $credential;
$responseHeaders = [];
$handle = curl_init($baseUrl . '/api/v1/inventory/warehouses/example');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 30,
CURLOPT_HEADERFUNCTION => static function ($handle, string $line) use (&$responseHeaders): int {
if (str_contains($line, ':')) {
[$name, $value] = explode(':', $line, 2);
$responseHeaders[strtolower(trim($name))] = trim($value);
}
return strlen($line);
},
]);
$raw = curl_exec($handle);
$status = curl_getinfo($handle, CURLINFO_RESPONSE_CODE);
$error = curl_error($handle);
curl_close($handle);
if ($raw === false) {
throw new RuntimeException('Transport error: ' . $error);
}
if ($status < 200 || $status >= 300) {
throw new RuntimeException('HTTP ' . $status . '; request_id=' .
($responseHeaders['x-request-id'] ?? '') . '; retry_after=' . ($responseHeaders['retry-after'] ?? ''));
}
$result = $raw === '' ? null : json_decode($raw, true, 512, JSON_THROW_ON_ERROR | JSON_BIGINT_AS_STRING);
echo json_encode($result, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE), PHP_EOL;
Python
from contextlib import ExitStack
import json
import os
from urllib.parse import urlsplit
import requests # python -m pip install requests
base_url = os.environ["SHOPENTLY_SHOP_URL"].rstrip("/")
origin = urlsplit(base_url)
if origin.scheme != "https" or not origin.hostname or origin.username or origin.password or origin.path or origin.query or origin.fragment:
raise ValueError("SHOPENTLY_SHOP_URL must be an HTTPS origin")
credential = os.environ['SHOPENTLY_ACCESS_TOKEN']
if not credential or "\r" in credential or "\n" in credential:
raise ValueError("Invalid credential")
headers = {}
headers["Authorization"] = 'Bearer' + " " + credential
body = None
if body is not None:
headers["Content-Type"] = "application/json"
with ExitStack() as stack:
session = stack.enter_context(requests.Session())
files = None
if False:
image = stack.enter_context(open(os.environ["SHOPENTLY_IMAGE_FILE"], "rb"))
if os.fstat(image.fileno()).st_size > 5242880:
raise ValueError("Image exceeds 5 MiB")
files = {"file": ("article.png", image, "image/png")}
response = session.request(
'GET', base_url + '/api/v1/inventory/warehouses/example', headers=headers,
data=body.encode("utf-8") if body is not None else None, files=files,
timeout=(5, 30), allow_redirects=False,
)
if not 200 <= response.status_code < 300:
raise RuntimeError(f"HTTP {response.status_code}; request_id={response.headers.get('X-Request-ID', '')}; retry_after={response.headers.get('Retry-After', '')}")
if False:
if response.headers.get("Content-Type") != "image/webp" or len(response.content) > 5242880:
raise ValueError("Unexpected image response")
with open(os.environ["SHOPENTLY_OUTPUT_FILE"], "xb") as output:
output.write(response.content)
else:
result = response.json() if response.content else None
print(json.dumps(result, ensure_ascii=False, indent=2))
응답 예제 200
{
"data": {
"active": true,
"address_line": "example",
"city": "example",
"code": "example",
"country_code": "PL",
"created_at": "2026-01-01T12:00:00Z",
"customer_visible": false,
"id": "example",
"name": "Example",
"postal_code": "example",
"updated_at": "2026-01-01T12:00:00Z",
"version": 1
},
"meta": {
"request_id": "example"
}
}
작동 방식
- 창고 목록과 상세 엔드포인트를 사용한 후 선택한 창고의 위치를 조회하세요.
- 반환된 식별자를 저장해 재고 변경 또는 입고 기록에 사용하세요.
- 이 API 참조에는 창고와 위치 읽기 작업이 제공됩니다.
- 창고 생성, 편집, 삭제는 정의하지 않으며 해당 작업에는 스토어가 지원하는 관리 기능을 사용하세요.
매개변수
경로 매개변수
warehouse_id문자열필수창고 식별자입니다.
제약 조건
pattern"^[a-z0-9][a-z0-9_-]{0,62}$"
이 작업은 JSON 본문을 받지 않습니다.
응답
응답 200
전체 모델: ApiResponse_WarehouseData_
dataWarehouseData필수성공 응답의 데이터입니다.
필드 ·
dataactive불리언필수리소스가 활성 상태인지 나타냅니다.
address_line문자열 null필수주소 행입니다.
city문자열 null필수도시 또는 지역입니다.
code문자열필수안정적인 기계 판독용 코드입니다.
country_code문자열필수국가 코드입니다.
created_at문자열필수생성 시각입니다.
format:"date-time"customer_visible불리언필수고객에게 표시되는 상태인지 나타냅니다.
id문자열필수리소스 식별자이며 반환된 값을 그대로 유지해야 합니다.
name문자열필수해당 컨텍스트의 리소스 이름입니다.
postal_code문자열 null필수우편번호입니다.
updated_at문자열필수가장 최근 업데이트 시각입니다.
format:"date-time"version정수필수동시성 제어에 사용하는 리소스 버전입니다.
metaContextPageMetaContextMetaPageMetaRequestMeta필수응답 메타데이터입니다.
필드 ·
metalocale문자열필수이 요청에서 선택한 언어입니다.
market_code문자열필수컨텍스트 엔드포인트가 반환한 시장 코드입니다.
market_id문자열필수컨텍스트 엔드포인트가 반환한 시장 식별자입니다.
paginationPagination필수커서 기반 페이지 나누기 메타데이터입니다.
request_id문자열필수고객 요청 식별자이며 응답 메타데이터에서는 HTTP 요청을 식별합니다.
minLength:1maxLength:100
locale문자열필수이 요청에서 선택한 언어입니다.
market_code문자열필수컨텍스트 엔드포인트가 반환한 시장 코드입니다.
market_id문자열필수컨텍스트 엔드포인트가 반환한 시장 식별자입니다.
request_id문자열필수고객 요청 식별자이며 응답 메타데이터에서는 HTTP 요청을 식별합니다.
minLength:1maxLength:100
paginationPagination필수커서 기반 페이지 나누기 메타데이터입니다.
request_id문자열필수고객 요청 식별자이며 응답 메타데이터에서는 HTTP 요청을 식별합니다.
minLength:1maxLength:100
request_id문자열필수고객 요청 식별자이며 응답 메타데이터에서는 HTTP 요청을 식별합니다.
minLength:1maxLength:100
HTTP 상태
200- 성공 응답 스키마
400- 잘못된 요청
401- 인증 필요
403- 권한 없음
404- 리소스를 찾을 수 없음
409- 버전 충돌
422- 유효성 검사 실패
429- 요청 한도 초과
기타 HTTP 상태 (7)
405- 허용되지 않은 메서드
413- 요청이 너무 큼
415- 지원하지 않는 형식
500- 서버 오류
502- API 게이트웨이 오류
503- 서비스 이용 불가
504- 시간 초과
오류 목록: ErrorResponse
헤더
401
WWW-Authenticate문자열선택 사항서버가 요구하는 인증 방식입니다.
405
Allow문자열선택 사항이 리소스가 지원하는 HTTP 메서드입니다.
429, 503
Retry-After정수선택 사항재시도 전에 기다려야 하는 최소 시간(초)입니다.
minimum:0