অনুরোধ করা

এই নির্দেশিকাটি ধরে নেয় যে আপনি আমাদের শুরু করা গাইডের মাধ্যমে কাজ করেছেন এবং অনুমোদিত অনুরোধ করার জন্য সেট আপ করেছেন৷

আপনি সবকিছু সেট আপ করার পরে, আপনি কেনাকাটার জন্য Google সামগ্রী API-তে অনুরোধ পাঠাতে পারেন৷ নিম্নলিখিত কোড নমুনাগুলি দেখায় কিভাবে কয়েকটি সহজ অনুরোধ পাঠাতে হয়:

  • একটি পণ্য তৈরি করুন.
  • পণ্যের একটি তালিকা পান।
  • তালিকা থেকে একটি নির্দিষ্ট পণ্য পুনরুদ্ধার করুন.
  • পণ্যের দাম আপডেট করুন।

পদ্ধতির সম্পূর্ণ তালিকার জন্য, রেফারেন্স ডকুমেন্টেশন দেখুন।

আরও তথ্যের জন্য, সর্বোত্তম অনুশীলন পৃষ্ঠাটি দেখুন, যেটি ব্যাখ্যা করে কিভাবে API-কে সর্বোত্তমভাবে ব্যবহার করতে হয়। এই পৃষ্ঠাটি ব্যাখ্যা করে যে কেন ব্যাচ অনুরোধগুলি সুপারিশ করা হয়৷

কন্টেন্ট এপিআই নিয়ে আপনার সমস্যা হলে, বিভ্রাটের জন্য বণিক কেন্দ্রের স্ট্যাটাস ড্যাশবোর্ড এবং ফোরাম পৃষ্ঠা দেখুন। আপনার যদি এখনও সাহায্যের প্রয়োজন হয়, সহায়তার সাথে যোগাযোগ করুন

একটি পণ্য তৈরি করুন

আপনি পণ্যের ফিড স্পেসিফিকেশনে একটি পণ্যের সমস্ত বৈশিষ্ট্যের সম্পূর্ণ বিবরণ খুঁজে পেতে পারেন। একটি পণ্য তৈরি করতে, নিম্নলিখিত কোড ব্যবহার করুন:

প্রোটোকল

POST /content/v2.1/YOUR_MERCHANT_ID/products

{
  "offerId": "book123",
  "title": "A Tale of Two Cities",
  "description": "A classic novel about the French Revolution",
  "link": "http://my-book-shop.com/tale-of-two-cities.html",
  "imageLink": "http://my-book-shop.com/tale-of-two-cities.jpg",
  "contentLanguage": "en",
  "targetCountry": "GB",
  "feedLabel": "GB",
  "channel": "online",
  "availability": "in stock",
  "condition": "new",
  "googleProductCategory": "Media > Books",
  "gtin": "9780007350896",
  "price": {
    "value": "2.50",
    "currency": "GBP"
  },
  "shipping": [{
    "country": "GB",
    "service": "Standard shipping",
    "price": {
      "value": "0.99",
      "currency": "GBP"
    }
  }],
  "shippingWeight": {
    "value": "200",
    "unit": "grams"
  }
}

জাভা

Product product = new Product();

product.setOfferId("book123");
product.setTitle("A Tale of Two Cities");
product.setDescription("A classic novel about the French Revolution");
product.setLink("http://my-book-shop.com/tale-of-two-cities.html");
product.setImageLink("http://my-book-shop.com/tale-of-two-cities.jpg");
product.setContentLanguage("en");
product.setTargetCountry("GB");
product.setChannel("online");
product.setAvailability("in stock");
product.setCondition("new");
product.setGoogleProductCategory("Media > Books");
product.setGtin("9780007350896");

Price price = new Price();
price.setValue("2.50");
price.setCurrency("GBP");
product.setPrice(price);

Price shippingPrice = new Price();
shippingPrice.setValue("0.99");
shippingPrice.setCurrency("GBP");

ProductShipping shipping = new ProductShipping();
shipping.setPrice(shippingPrice);
shipping.setCountry("GB");
shipping.setService("Standard shipping");

ArrayList shippingList = new ArrayList();
shippingList.add(shipping);
product.setShipping(shippingList);

Product result = service.products().insert(merchantId, product).execute();

পিএইচপি

$product = new Google_Service_ShoppingContent_Product();
$product->setOfferId('book123');
$product->setTitle('A Tale of Two Cities');
$product->setDescription('A classic novel about the French Revolution');
$product->setLink('http://my-book-shop.com/tale-of-two-cities.html');
$product->setImageLink('http://my-book-shop.com/tale-of-two-cities.jpg');
$product->setContentLanguage('en');
$product->setTargetCountry('GB');
$product->setChannel('online');
$product->setAvailability('in stock');
$product->setCondition('new');
$product->setGoogleProductCategory('Media > Books');
$product->setGtin('9780007350896');

$price = new Google_Service_ShoppingContent_Price();
$price->setValue('2.50');
$price->setCurrency('GBP');

$shipping_price = new Google_Service_ShoppingContent_Price();
$shipping_price->setValue('0.99');
$shipping_price->setCurrency('GBP');

$shipping = new Google_Service_ShoppingContent_ProductShipping();
$shipping->setPrice($shipping_price);
$shipping->setCountry('GB');
$shipping->setService('Standard shipping');

$shipping_weight = new Google_Service_ShoppingContent_ProductShippingWeight();
$shipping_weight->setValue(200);
$shipping_weight->setUnit('grams');

$product->setPrice($price);
$product->setShipping(array($shipping));
$product->setShippingWeight($shipping_weight);

$result = $service->products->insert($merchant_id, $product);

পণ্যের একটি তালিকা পান

পণ্যের একটি তালিকা পেতে , নিম্নলিখিত কোড ব্যবহার করুন:

প্রোটোকল

GET /content/v2.1/YOUR_MERCHANT_ID/products

জাভা

List productsList = service.products().list(merchantId);

ProductsListResponse page = productsList.execute();
while ((page.getResources() != null) && !page.getResources().isEmpty()) {
  for (Product product : page.getResources()) {
    System.out.printf("%s %s%n", product.getId(), product.getTitle());
  }

  if (page.getNextPageToken() == null) {
    break;
  }

  productsList.setPageToken(page.getNextPageToken());
  page = productsList.execute();
}

পিএইচপি

$products = $service->products->listProducts($merchantId);
$parameters = array();
while (!empty($products->getResources()) {
  foreach ($products->getResources() as $product) {
    printf("%s %s\n", $product->getId(), $product->getTitle());
  }
  if (!empty($products->getNextPageToken()) {
    break;
  }
  $parameters['pageToken'] = $products->nextPageToken;
  $products = $service->products->listProducts($merchantId, $parameters);
}

একটি নির্দিষ্ট পণ্য পুনরুদ্ধার করুন

তালিকা থেকে একটি নির্দিষ্ট পণ্য পুনরুদ্ধার করতে, নিম্নলিখিত কোড ব্যবহার করুন:

প্রোটোকল

GET /content/v2.1/YOUR_MERCHANT_ID/products/online:en:GB:book123

জাভা

Product product = service.products()
    .get(merchantId, "online:en:GB:book123")
    .execute();
System.out.printf("%s %s\n", product.getId(), product.getTitle());

পিএইচপি

$product = $service->products->get($merchant_id, 'online:en:GB:book123');
printf("%s %s\n", $product->getId(), $product->getTitle());

অনলাইন পণ্য প্রাপ্যতা আপডেট

আপনি নিম্নলিখিত কোড সহ অনলাইন পণ্য ডেটা আপডেট করতে পণ্য সংস্থানে সম্পূরক ফিডগুলি ব্যবহার করতে পারেন:

প্রোটোকল

POST /content/v2.1/YOUR_MERCHANT_ID/products?YOUR_SUPPLEMENTAL_FEED_ID

{
  "offerId": "book123",
  "contentLanguage": "en",
  "targetCountry": "GB",
  "feedLabel": "GB",
  "channel": "online",
  "availability": "out of stock"
}

জাভা

Product product = new Product();
// Mandatory Fields
product.setOfferId("book123");
product.setContentLanguage("en");
product.setTargetCountry("GB");
product.setChannel("online");

// Optional Fields to Update
product.setAvailability("out of stock");

// Your unique supplemental feedId
feedId=123456789

Product result = service.products().insert(merchantId, product, feedId).execute();

পিএইচপি

$product = new Google_Service_ShoppingContent_Product();
// Mandatory Fields
$product->setOfferId('book123');
$product->setContentLanguage('en');
$product->setTargetCountry('GB');
$product->setChannel('online');

// Optional Fields to Update
$product->setAvailability('out of stock');

// Your unique supplemental feedId
$feedId=123456789

$result = $service->products->insert($merchant_id, $product, $feedId);

স্থানীয় পণ্যের প্রাপ্যতা আপডেট করুন

আপনি নিম্নলিখিত কোড সহ স্থানীয় পণ্য ডেটা আপডেট করতে স্থানীয় ইনভেন্টরি পরিষেবা ব্যবহার করতে পারেন:

প্রোটোকল

POST /content/v2.1/YOUR_MERCHANT_ID/localinventory/online/products/online:en:GB:book123

{
  "availability": "out of stock"
}

জাভা

Product product = new Product();
// Mandatory Fields
product.setOfferId("book123");
product.setContentLanguage("en");
product.setTargetCountry("GB");
product.setChannel("online");

// Optional Fields to Update
product.setAvailability("out of stock");

Product result = service.localinventory().insert(merchantId, product).execute();

পিএইচপি

$product = new Google_Service_ShoppingContent_Product();
// Mandatory Fields
$product->setOfferId('book123');
$product->setContentLanguage('en');
$product->setTargetCountry('GB');
$product->setChannel('online');

// Optional Fields to Update
$product->setAvailability('out of stock');

$result = $service->localinventory->insert($merchant_id, $product);