ShippingSettings
संसाधन की मदद से, अपने खाते की शिपिंग सेटिंग को वापस पाया और अपडेट किया जा सकता है.
Google, कुछ प्रॉडक्ट के लिए डिलीवरी के अनुमानित समय को अपने-आप अपडेट कर सकता है. ज़्यादा जानकारी के लिए, अपने-आप होने वाले सुधारों की सुविधा चालू करना लेख पढ़ें.
शिपिंग की सेटिंग देखना, उनमें बदलाव करना या उन्हें अपडेट करना
Merchant API की शिपिंग सेवा का इस्तेमाल करने के लिए, यह तरीका अपनाएं:
- अपने खाते की शिपिंग की पूरी सेटिंग वापस पाने के लिए,
GETअनुरोध करें. - शिपिंग की सेटिंग में बदलाव करें.
- शिपिंग की बदली गई सेटिंग के साथ
INSERTअनुरोध करें.
Etag
Etag, कोड में बदला गया एक टोकन है. इसका इस्तेमाल, एसिंक्रोनस अपडेट से बचने के लिए किया जाता है. शिपिंग की सेटिंग का कोई भी डेटा बदलने पर, etag बदल जाता है. उपयोगकर्ताओं को GET अनुरोध से मिले ई-टैग को INSERT अनुरोध के मुख्य हिस्से में कॉपी करना होगा.
अगर GET अनुरोध और INSERT अनुरोध के बीच शिपिंग सेटिंग का डेटा बदल जाता है, तो आपको गड़बड़ी का मैसेज मिलता है. इसमें सबसे हाल का etag टोकन पाने के लिए, एक और GET अनुरोध करने के लिए कहा जाता है. नया ई-टैग टोकन पाने के लिए, आपको GET अनुरोध को कॉल करना होगा. इसके बाद, नए ई-टैग टोकन को 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 सैंपल से पता चलता है कि Merchant Center खाते के लिए, वेयरहाउस की जानकारी मैनेज करने के लिए, Merchant Shipping settings सेवा का इस्तेमाल कैसे किया जा सकता है:
"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 का इस्तेमाल करें.
अपने वेयरहाउस मैनेज करना
अपने वेयरहाउस मैनेज करने के लिए, Merchant API का इस्तेमाल करने का तरीका यहां बताया गया है:
- अपने सभी मौजूदा
shippingsettingsऔर वेयरहाउस की जानकारी पाने के लिए,GETअनुरोध करें. shippingsettingsकोGETअनुरोध सेUPDATEअनुरोध में कॉपी करें.अगर आपको
INSERTअनुरोध के लिए,warehousesसेक्शन में वेयरहाउस का इस्तेमाल करना है, तो उन्हें भरें.UPDATEअनुरोध करें, जिसमेंshippingsettingsऔरwarehousesसंसाधन शामिल हों.
यहां INSERT अनुरोध के मुख्य हिस्से का एक सैंपल दिया गया है. इसमें वेयरहाउस 1 के लिए वेयरहाउस को न्यूयॉर्क से माउंटेन व्यू पर अपडेट किया गया है:
{
"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 का इस्तेमाल करके, ऑर्डर वाले दिन डिलीवरी करने की सुविधा को कॉन्फ़िगर किया जा सकता है. ऑर्डर वाले दिन डिलीवरी करने वाली शिपिंग सेवाओं के लिए, local_delivery को shipment_type के तौर पर सेट किया गया है. फ़िलहाल, 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 से माइग्रेट करने के बारे में जानने के लिए, शिपिंग की सेटिंग मैनेज करने की सुविधा को माइग्रेट करना लेख पढ़ें.