शिपिंग की सेटिंग के बारे में खास जानकारी

ShippingSettings रिसॉर्स की मदद से, अपने खाते की शिपिंग सेटिंग को वापस पाया जा सकता है और उन्हें अपडेट किया जा सकता है.

Google, कुछ प्रॉडक्ट के लिए डिलीवरी में लगने वाले समय के अनुमान को अपने-आप अपडेट कर सकता है. ज़्यादा जानकारी के लिए, अपने-आप बेहतर होने की सुविधा चालू करना लेख पढ़ें.

शिपिंग की सेटिंग देखना, उनमें बदलाव करना या उन्हें अपडेट करना

Merchant API की शिपिंग सेवा का इस्तेमाल करने के लिए, यह तरीका अपनाएं:

  1. अपने खाते की शिपिंग की पूरी सेटिंग वापस पाने के लिए, GET अनुरोध करें.
  2. शिपिंग की सेटिंग में बदलाव करें.
  3. बदली गई शिपिंग सेटिंग के साथ INSERT अनुरोध करें.

ETag

Etag, एक कोड में बदला गया टोकन है. इसका इस्तेमाल एसिंक्रोनस अपडेट से बचने के लिए किया जाता है. शिपिंग की किसी भी सेटिंग का डेटा बदलने पर, ईटैग बदल जाता है. उपयोगकर्ताओं को GET अनुरोध से मिला ईटैग, INSERT अनुरोध के मुख्य हिस्से में कॉपी करना होगा.

अगर GET अनुरोध और INSERT अनुरोध के बीच शिपिंग सेटिंग के डेटा में बदलाव होता है, तो आपको गड़बड़ी का एक मैसेज मिलता है. इसमें सबसे नया ईटैग टोकन पाने के लिए, एक और 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 का इस्तेमाल करने का तरीका यहां बताया गया है:

  1. अपने सभी मौजूदा shippingsettings और वेयरहाउस वापस पाने के लिए, GET अनुरोध करें.
  2. GET अनुरोध से shippingsettings को UPDATE अनुरोध में कॉपी करें.

  3. अगर आपको INSERT अनुरोध के लिए, warehouses सेक्शन में वेयरहाउस का इस्तेमाल करना है, तो उन्हें भरें.

  4. UPDATE अनुरोध करें. इसमें shippingsettings और warehouses संसाधन शामिल हों.

यहां INSERT अनुरोध के मुख्य हिस्से का एक सैंपल दिया गया है. इसमें Warehouse 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 फ़ील्ड को सही पर सेट करें. अगले दिन डिलीवरी करने की सुविधा बंद करने पर, आपकी शिपिंग सेवाएं हर दिन सिर्फ़ कटऑफ़ समय से पहले दिखती हैं.

अगले दिन डिलीवरी की सुविधा सिर्फ़ तब उपलब्ध होती है, जब shipment_type local_delivery हो.

ज़्यादा जानें

Content API for Shopping से माइग्रेट करने के बारे में जानने के लिए, शिपिंग की सेटिंग मैनेज करने की सुविधा माइग्रेट करना लेख पढ़ें.