ShippingSettings
리소스를 사용하면 계정의 배송 설정을 가져오고 업데이트할 수 있습니다.
Google에서 일부 제품의 예상 배송 시간을 자동으로 업데이트할 수 있습니다. 자세한 내용은 자동 개선 사용 설정을 참고하세요.
배송 설정 읽기, 쓰기 또는 업데이트
판매자 API 배송 서비스를 사용하려면 다음 단계를 따르세요.
GET요청을 보내 계정의 전체 배송 설정을 가져옵니다.- 배송 설정을 수정합니다.
- 수정된 배송 설정으로
INSERT요청을 보냅니다.
ETag
ETag는 비동기 업데이트를 방지하기 위해 인코딩된 토큰입니다. 배송 설정 데이터가 변경되면 ETag가 변경됩니다. 사용자는 GET 요청에서 가져온 ETag를 INSERT 요청 본문에 복사해야 합니다.
GET 요청과 INSERT 요청 사이에 배송 설정 데이터가 변경되면 최신 ETag 토큰을 가져오기 위해 다른 GET 요청을 요청하는 오류 메시지가 표시됩니다. GET 요청을 호출하여 새 ETag 토큰을 가져오고 새 ETag 토큰을 INSERT 요청 본문에 복사해야 합니다.
배송 설정 추가
shippingsettings.insert를 사용하여 계정의 배송 설정을 추가하거나 업데이트합니다. 다음은 계정
10의 GSA Shipping - Free Ship Over $49.99라는 배송 서비스의 maxTransitDays를 7로 업데이트하는 샘플 요청입니다.
POST https://merchantapi.googleapis.com/accounts/v1/accounts/{accountId}/shippingSettings/
{
"services": [
{
"name": "FedEx",
"active": true,
"deliveryCountries": ["US"],
"currencyCode": "USD",
"deliveryTime": {
"minTransitDays": 4,
"maxTransitDays": 6,
"minHandlingDays": 0,
"maxHandlingDays": 0
},
"rateGroups": [
{
"singleValue": {
"flatRate": {
"amountMicros": 5990000,
"currencyCode": "USD"
}
},
"name": "All products"
}
]
},
{
"name": "GSA Shipping - Free Ship Over $49.99",
"active": true,
"deliveryCountries": "US",
"currencyCode": "USD",
"deliveryTime": {
"minTransitDays": 3,
"maxTransitDays": 7,
"minHandlingDays": 1,
"maxHandlingDays": 2
},
"rateGroups": [
{
"mainTable": {
"rowHeaders": {
"prices": [
{
"amountMicros": 49990000,
"currencyCode": "USD"
},
{
"amountMicros": -1,
"currencyCode": "USD"
}
]
},
"rows": [
{
"cells": [
{
"flatRate": {
"amountMicros": 6990000,
"currencyCode": "USD"
}
}
]
},
{
"cells": [
{
"flatRate": {
"amountMicros": 0,
"currencyCode": "USD"
}
}
]
}
]
},
"name": "Free Ship Over $49.99"
}
]
}
]
}
다음은 배송 설정을 삽입하는 데 사용할 수 있는 샘플입니다.
Python
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import GetShippingSettingsRequest
from google.shopping.merchant_accounts_v1 import ShippingSettingsServiceClient
_ACCOUNT = configuration.Configuration().read_merchant_info()
_PARENT = f"accounts/{_ACCOUNT}"
def get_shipping_settings():
"""Gets the ShippingSettings for a given Merchant Center account."""
# Gets OAuth Credentials.
credentials = generate_user_credentials.main()
# Creates a client.
client = ShippingSettingsServiceClient(credentials=credentials)
# Creates the Shipping Settings name
name = _PARENT + "/shippingSettings"
# Creates the request.
request = GetShippingSettingsRequest(name=name)
# Makes the request and prints the retrieved ShippingSettings.
try:
response = client.get_shipping_settings(request=request)
print("Retrieved ShippingSettings below")
print(response)
except RuntimeError as e:
print(e)
if __name__ == "__main__":
get_shipping_settings()
웨어하우스 설정
다음 JSON 샘플은 판매자 배송 설정 서비스를 사용하여 판매자 센터 계정의 웨어하우스 정보를 관리하는 방법을 보여줍니다.
"warehouses": [
{
"name": "warehouse 1",
"shippingAddress": {
"streetAddress": {street_address},
"city": {city},
"administrativeArea": {administrative_area},
"postalCode": {postal_code},
"regionCode": {region_code}
},
"cutoffTime": {
"minutes": {minutes}
},
"handlingDays": {handling_days},
"businessDaysConfig": {
"businessDays": [
"MONDAY", "SUNDAY"
]
}
}
]
다음을 바꿉니다.
- {street_address}: 웨어하우스 주소의 도로 수준 부분입니다.
- {city}: 웨어하우스가 있는 도시, 마을 또는 코뮌입니다.
- {administrative_area}: 국가의 행정 구역입니다. 예: 주
- {postal_code}: 우편번호입니다.
- {region_code}: 문자열의 국가 코드입니다.
- {minutes}: 웨어하우스에서 당일 처리하기 위해 주문해야 하는 마감 시간의 분 부분입니다.
- {handling_days}: 이 웨어하우스에서 상품을 포장하고 배송하는 데 걸리는 일수입니다.
warehouses 리소스는 웨어하우스 목록입니다. 각 웨어하우스는 warehouse.name을 통해 배송 서비스의 웨어하우스 기반 배송 시간으로 참조할 수 있습니다.
웨어하우스 관리
다음은 판매자 API를 사용하여 웨어하우스를 관리하는 방법입니다.
GET요청을 보내 기존의 모든shippingsettings및 웨어하우스를 가져옵니다.GET요청에서shippingsettings를UPDATE요청에 복사합니다.INSERT요청의warehouses섹션에서 웨어하우스를 사용하려면 웨어하우스를 채웁니다.shippingsettings및warehouses리소스가 포함된UPDATE요청을 보냅니다.
다음은 뉴욕에서 마운틴뷰로 업데이트된 웨어하우스 1 의 웨어하우스가 포함된 샘플 INSERT 요청 본문입니다.
{
"services": [
{
"name": "Standard Shipping",
"active": true,
"deliveryCountries": ["US", "UK"],
"currencyCode": "USD",
"deliveryTime": {
"minHandlingDays": 0,
"maxHandlingDays": 1,
"warehouseBasedDeliveryTimes": [
{"carrier": "Fedex"
"carrierService": "ground"
"warehouse": "Warehouse 1"
},
{"carrier": "Fedex"
"carrierService": "2 days"
"warehouse": "Warehouse 2"
}
]
},
"rateGroups": [
{
"singleValue": {
"flatRate": {
"amountMicros": 0,
"currencyCode": "USD"
}
},
"name": "Standard Shipping"
}
],
},
{
"name": "Expedited",
"flatRate": {
"amountMicros": 9990000,
"currencyCode": "USD"
}
},
"name": "Expedited"
}
],
}
],
"warehouses": [
{
"name": "Warehouse1",
"shippingAddress": [
{
"streetAddress": "1111 shoreline street"
"city": "Mountain View",
"administrativeArea": "CA"
}
]
},
{
"name": "Warehouse 2",
"country": "US",
"postalCodeRanges": [
{
"streetAddress": "1111 5th avenue"
"city": "New York",
"administrativeArea": "NY"
}
]
}
]
}
당일 배송 추가
오프라인 판매점 인벤토리가 있는 경우 Content API for Shopping을 사용하여 당일 배송 배송 서비스를 구성할 수 있습니다. 당일 배송 배송 서비스의 shipment_type은 local_delivery입니다. 현재 모든 local_delivery 배송 서비스는 당일 배송으로 간주됩니다.
오프라인 배송의 delivery_time 정보는 변경할 수 없습니다. shippingsettings.insert를 사용하여 오프라인 판매점 인벤토리 제품의 당일 배송을 설정합니다.
다음은 계정의 모든 매장에 당일 배송 서비스를 추가하는 샘플 요청 본문입니다.
{
"name": "accounts/accountId/shippingSettings",
"services": [
{
"name": "Local Delivery",
"active": true,
"shipmentType": "local_delivery",
"deliveryCountries": "US",
"currencyCode": "USD",
"rateGroups": [
{
"singleValue": {
"flatRate": {
"amountMicros": 0,
"currencyCode": "USD"
}
}
}
],
"storeConfig": {
"storeServiceType": "all stores",
"storeCodes": [],
"cutoffConfig": {
"storeCloseOffsetHours": 2,
"noDeliveryPostCutoff": true
},
"serviceRadius": {
"value": 4,
"unit": "Miles"
}
}
}
]
}
다음날 배송 추가
당일 배송 마감 시간 이후에 주문한 상품은 기본적으로 다음날 배송으로 예약됩니다. 다음날 배송을 사용 중지하려면 no_delivery_post_cutoff 필드를 true로 설정합니다. 다음날 배송을 사용 중지하면 배송 서비스가 매일 마감 시간 전에만 표시됩니다.
다음날 배송은 shipment_type이 local_delivery인 경우에만 사용할 수 있습니다.
자세히 알아보기
Content API for Shopping에서 이전하는 방법을 알아보려면 배송 설정 관리 이전을 참고하세요.