बैच मोड

custombatch से insert, get या delete के लिए, एक एपीआई कॉल में एक बार में एक से ज़्यादा प्रॉडक्ट का इस्तेमाल किया जा सकता है.

कस्टम बैच एपीआई को कॉल करने के लिए, नीचे दिए गए अनुरोध के यूआरएल का इस्तेमाल करें:

POST https://shoppingcontent.googleapis.com/content/v2.1/products/batch

अनुरोध के मुख्य हिस्से में कुछ खास पैरामीटर शामिल होते हैं: batchId, merchantID, और method.

सिर्फ़ productId का इस्तेमाल तब करें, जब आपको 'पाएं' या 'मिटाना' को लागू करना हो. custombatch के लिए एपीआई कॉल शामिल करने के लिए, productId की ज़रूरत नहीं है.

कस्टमबैच:शामिल करें

products.custombatch method=insert बनाने के लिए, अनुरोध वाले इस यूआरएल का इस्तेमाल किया जाता है

POST https://shoppingcontent.googleapis.com/content/v2.1/products/batch

दो नए प्रॉडक्ट डालने के लिए, हर प्रॉडक्ट के लिए batchId, एपीआई कॉल करने की अनुमति वाले व्यापारी/कंपनी का merchantId, और तरीका insert की जानकारी दें.

यहां दिए गए उदाहरण में, batchId की वैल्यू 1111 और 1112 हैं. साथ ही, ये हर प्रॉडक्ट के यूनीक आइडेंटिफ़ायर हैं. merchantId: 1234567 वह व्यापारी/कंपनी है जिसके पास एपीआई कॉल करने की अनुमति है. साथ ही, यह get, delete या insert तरीका है.

insert एक नया प्रॉडक्ट बनाता है. अगर किसी प्रॉडक्ट के लिए channel, contentLanguage, offerId, और feedLabel एट्रिब्यूट की वैल्यू मौजूद हैं, तो यह तरीका एंट्री को अपडेट करता है और प्रॉडक्ट के लिए पिछले एपीआई कॉल का सारा डेटा बदल देता है.

एक एपीआई कॉल का इस्तेमाल करके, Merchant Center के डेटाबेस में दो टी-शर्ट से insert दो टी-शर्ट का सैंपल दिया गया है:

{
  "entries": [
    {
      "batchId": 1111,
      "merchantId": 1234567,
      "method": "insert",
      "product": {
        "kind": "content#product",
        "offerId": "1111111111",

        "title": "Google Tee Black",
        "description": "The Black Google Tee is available in unisex sizing and
        features a retail fit.",
        "link": "http://my.site.com/blacktee/",
        "imageLink": "https://shop.example.com/.../images/GGOEGXXX1100.jpg",
        "contentLanguage": "en",
        "targetCountry": "US",
        "feedLabel": "US",
        "channel": "online",
        "ageGroup": "adult",
        "availability": "in stock",
        "availabilityDate": "2019-01-25T13:00:00-08:00",
        "brand": "Google",
        "color": "black",
        "condition": "new",
        "gender": "male",
        "googleProductCategory": "1604",
        "gtin": "608802531656",
        "itemGroupId": "google_tee",
        "mpn": "608802531656",
        "price": {
          "value": "21.99",
          "currency": "USD"
        },
        "sizes": [
          "Large"
        ],
        "includedDestination": [
          "Shopping"
        ]
      }
    },
    {
      "batchId": 1112,
      "merchantId": 1234567,
      "method": "insert",
      "product": {
        "kind": "content#product",
        "offerId": "2222222222",

        "title": "Google Tee Green",
        "description": "100% cotton jersey fabric sets  this Google t-shirt above
        the crowd. Features the google logo across the chest. Unisex sizing.",
        "link": "http://my.site.com/greentee/",
        "imageLink": "https://shop.example.com/.../images/GGOEGXXX0906.jpg",
        "contentLanguage": "en",
        "targetCountry": "US",
        "feedLabel": "US",
        "channel": "online",
        "ageGroup": "adult",
        "availability": "in stock",
        "availabilityDate": "2019-01-25T13:00:00-08:00",
        "brand": "Google",
        "color": "green",
        "condition": "new",
        "gender": "male",
        "googleProductCategory": "1604",
        "gtin": "608802531649",
        "itemGroupId": "google_tee",
        "mpn": "608802531649",
        "price": {
          "value": "21.99",
          "currency": "USD"
        },
        "sizes": [
          "Medium"
        ],
        "includedDestination": [
          "Shopping"
        ]
      }
    }
  ]
}

एपीआई कॉल पूरे होने पर, HTTP 200 कोड और JSON रिस्पॉन्स मिलता है. इसमें, जोड़े गए प्रॉडक्ट भी शामिल होते हैं. JSON को रिटर्न करने का फ़ॉर्मैट ऐसा होता है:

{
 "kind": "content#productsCustomBatchResponse",
 "entries": [
  {
   "kind": "content#productsCustomBatchResponseEntry",
   "batchId": 1111,
   "product": {
    "kind": "content#product",
    "id": "online:en:US:1111111111",
    "offerId": "1111111111",
    "title": "Google Tee Black",
    "description": "The Black Google Tee is available in unisex sizing and
    features a retail fit.",
    "link": "http://my.site.com/blacktee/",
    "imageLink": "https://shop.example.com/.../images/GGOEGXXX1100.jpg",
    "contentLanguage": "en",
    "targetCountry": "US",
    "feedLabel": "US",
    "channel": "online",
    "ageGroup": "adult",
    "availability": "in stock",
    "availabilityDate": "2019-01-25T13:00:00-08:00",
    "brand": "Google",
    "color": "black",
    "condition": "new",
    "gender": "male",
    "googleProductCategory": "1604",
    "gtin": "608802531656",
    "itemGroupId": "google_tee",
    "mpn": "608802531656",
    "price": {
     "value": "21.99",
     "currency": "USD"
    },
    "sizes": [
     "Large"
    ],
    "includedDestination": [
      "Shopping"
    ]
   }
  },
  {
   "kind": "content#productsCustomBatchResponseEntry",
   "batchId": 1112,
   "product": {
    "kind": "content#product",
    "id": "online:en:US:2222222222",
    "offerId": "2222222222",
    "title": "Google Tee Green",
    "description": "100% cotton jersey fabric sets this Google t-shirt above
    the crowd. Features the google logo across the chest. Unisex sizing.",
    "link": "http://my.site.com/greentee/",
    "imageLink": "https://shop.example.com/.../images/GGOEGXXX0906.jpg",
    "contentLanguage": "en",
    "targetCountry": "US",
    "feedLabel": "US",
    "channel": "online",
    "ageGroup": "adult",
    "availability": "in stock",
    "availabilityDate": "2019-01-25T13:00:00-08:00",
    "brand": "Google",
    "color": "green",
    "condition": "new",
    "gender": "male",
    "googleProductCategory": "1604",
    "gtin": "608802531649",
    "itemGroupId": "google_tee",
    "mpn": "608802531649",
    "price": {
     "value": "21.99",
     "currency": "USD"
    },
    "sizes": [
     "Medium"
    ],
    "includedDestination": [
      "Shopping"
    ]
   }
  }
 ]
}

कस्टमबैच:पाएं

अनुरोध करने वाले इस यूआरएल से, method=get के साथ products.custombatch कॉल किया जाता है:

POST https://shoppingcontent.googleapis.com/content/v2.1/products/batch

प्रॉडक्ट पाने के लिए, एपीआई कॉल वाले प्रॉडक्ट के लिए खास batchId, एपीआई कॉल करने के लिए अधिकृत व्यापारी/कंपनी/कारोबारी का merchantId, वापस लाए जा रहे प्रॉडक्ट के लिए get, और productId की जानकारी दें.

नीचे दिए गए उदाहरणों की मदद से, पिछले custombatch:insert उदाहरण का इस्तेमाल करके शामिल किए गए दो प्रॉडक्ट को वापस पाने के लिए, JSON अनुरोध की बॉडी का उदाहरण दिया गया है. इन प्रॉडक्ट की जानकारी productId की वैल्यू के ज़रिए दी जाती है. सूची में मौजूद हर आइटम के लिए, batchId यूनीक होता है:

{
  "entries": [
    {
      "batchId": 1113,
      "merchantId": 1234567,
      "method": "get",
      "productId": "online:en:US:1111111111"
    },
    {
      "batchId": 1114,
      "merchantId": 1234567,
      "method": "get",
      "productId": "online:en:US:2222222222"
    }
  ]
}

यह कॉल, HTTP 200 कोड और रिस्पॉन्स का यह मुख्य हिस्सा दिखाता है:

{
 "kind": "content#productsCustomBatchResponse",
 "entries": [
  {
   "kind": "content#productsCustomBatchResponseEntry",
   "batchId": 1113,
   "product": {
    "kind": "content#product",
    "id": "online:en:US:1111111111",
    "offerId": "1111111111",
    "title": "Google Tee Black",
    "description": "The Black Google Tee is available in unisex sizing and features a retail fit.",
    "link": "http://my.site.com/blacktee/",
    "imageLink": "https://shop.example.com/.../images/GGOEGXXX1100.jpg",
    "contentLanguage": "en",
    "targetCountry": "US",
    "feedLabel": "US",
    "channel": "online",
    "ageGroup": "adult",
    "availability": "in stock",
    "availabilityDate": "2019-01-25T13:00:00-08:00",
    "brand": "Google",
    "color": "black",
    "condition": "new",
    "gender": "male",
    "googleProductCategory": "1604",
    "gtin": "608802531656",
    "itemGroupId": "google_tee",
    "mpn": "608802531656",
    "price": {
     "value": "21.99",
     "currency": "USD"
    },
    "sizes": [
     "Large"
    ],
    "includedDestination": [
      "Shopping"
    ]
   }
  },
  {
   "kind": "content#productsCustomBatchResponseEntry",
   "batchId": 1114,
   "product": {
    "kind": "content#product",
    "id": "online:en:US:2222222222",
    "offerId": "2222222222",
    "title": "Google Tee Green",
    "description": "100% cotton jersey fabric sets this Google t-shirt above the crowd.
    Features the google logo across the chest. Unisex sizing.",
    "link": "http://my.site.com/greentee/",
    "imageLink": "https://shop.example.com/.../images/GGOEGXXX0906.jpg",
    "contentLanguage": "en",
    "targetCountry": "US",
    "feedLabel": "US",
    "channel": "online",
    "ageGroup": "adult",
    "availability": "in stock",
    "availabilityDate": "2019-01-25T13:00:00-08:00",
    "brand": "Google",
    "color": "green",
    "condition": "new",
    "gender": "male",
    "googleProductCategory": "1604",
    "gtin": "608802531649",
    "itemGroupId": "google_tee",
    "mpn": "608802531649",
    "price": {
     "value": "21.99",
     "currency": "USD"
    },
    "sizes": [
     "Medium"
    ],
    "includedDestination": [
      "Shopping"
    ]
   }
  }
 ]
}

custombatch:हटाएं

अनुरोध के इस यूआरएल का इस्तेमाल करके, method=delete के साथ products.custombatch बनाया जाता है:

POST https://shoppingcontent.googleapis.com/content/v2.1/products/batch

किसी प्रॉडक्ट को मिटाने के लिए, उस batchId की जानकारी दें जो इस एपीआई कॉल में मौजूद प्रॉडक्ट के लिए खास हो. साथ ही, एपीआई कॉल करने के लिए अधिकृत व्यापारी/कंपनी/कारोबारी का merchantId, मिटाए जाने वाले प्रॉडक्ट के लिए delete तरीका, और मिटाए जा रहे प्रॉडक्ट के productId की जानकारी भी दें.

{
  "entries": [
    {
      "batchId": 1115,
      "merchantId": 1234567,
      "method": "delete",
      "productId": "online:en:US:1111111111"
    },
    {
      "batchId": 1116,
      "merchantId": 1234567,
      "method": "delete",
      "productId": "online:en:US:2222222222"
    }
  ]
}

यह कॉल, HTTP 200 कोड और मिटाए गए आइटम की batchId वैल्यू दिखाता है:

{
 "kind": "content#productsCustomBatchResponse",
 "entries": [
  {
   "kind": "content#productsCustomBatchResponseEntry",
   "batchId": 1115
  },
  {
   "kind": "content#productsCustomBatchResponseEntry",
   "batchId": 1116
  }
 ]
}