আপনার পণ্য ঘন ঘন আপডেট করুন

প্রোডাক্টস সাব-এপিআই আপনাকে আপনার বিদ্যমান প্রোডাক্টগুলিতে আংশিক আপডেট করার সুযোগ দেয়। মূল্য এবং প্রাপ্যতার মতো ঘন ঘন পরিবর্তনশীল ডেটার জন্য এটি আদর্শ, কারণ এর ফলে একটি ছোট পরিবর্তনের জন্য পুরো প্রোডাক্টটি পুনরায় জমা দেওয়ার প্রয়োজন হয় না। তবে, সমস্ত প্রোডাক্ট ডেটা সিঙ্ক করা আছে কিনা তা নিশ্চিত করতে আপনার নিয়মিতভাবে প্রোডাক্টগুলি পুনরায় যুক্ত করা উচিত।

এই নির্দেশিকায় productinputs.patch মেথড ব্যবহার করে আপনার প্রোডাক্টগুলো কীভাবে আপডেট করতে হয়, তা আলোচনা করা হয়েছে।

পূর্বশর্ত

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

নির্দিষ্ট পণ্যের বিবরণ আপডেট করুন

কোনো পণ্যের সমস্ত তথ্য পুনরায় জমা না দিয়ে তার মূল্য বা প্রাপ্যতার মতো কয়েকটি বিবরণ পরিবর্তন করতে, productInputs.patch মেথডটি ব্যবহার করুন।

আপনি updateMask প্যারামিটারে নির্দিষ্ট করে দিতে পারেন যে আপনি কোন ফিল্ডগুলো পরিবর্তন করছেন। ` updateMask হলো আপনি যে ফিল্ডগুলো আপডেট করতে চান, সেগুলোর একটি কমা-দ্বারা-বিভক্ত তালিকা। ` patch মেথডটি নিম্নরূপভাবে কাজ করে:

  • updateMask এবং body-এর ফিল্ডসমূহ: এই ফিল্ডগুলো নতুন মান দিয়ে আপডেট করা হয়।
  • updateMask এ থাকা কিন্তু body-তে না থাকা ফিল্ডসমূহ: এই ফিল্ডগুলো প্রোডাক্ট ইনপুট থেকে মুছে ফেলা হয়।
  • updateMask এ অন্তর্ভুক্ত নয় এমন ফিল্ডসমূহ: এই ফিল্ডগুলো অপরিবর্তিত থাকে।
  • updateMask প্যারামিটার বাদ দেওয়া হলে: অনুরোধের মূল অংশে প্রদত্ত সমস্ত ফিল্ড আপডেট করা হয়। অনুরোধের মূল অংশে যে ফিল্ডগুলি প্রদান করা হয়নি, সেগুলি পণ্যের ইনপুট থেকে মুছে ফেলা হয় না।

আপডেট করার আগের পণ্যের তথ্যের একটি উদাহরণ নিচে দেওয়া হলো:

{
  "name": "accounts/{ACCOUNT_ID}/productInputs/en~US~SKU12345",
  "product": "accounts/{ACCOUNT_ID}/products/en~US~SKU12345",
  "offerId": "SKU12345",
  "contentLanguage": "en",
  "feedLabel": "US",
  "productAttributes": {
    "title": "Classic Cotton T-Shirt",
    "description": "A comfortable, durable, and stylish t-shirt made from 100% cotton.",
    "link": "https://www.example.com/p/SKU12345",
    "availability": "IN_STOCK",
    "price": {
      "amountMicros": "15990000",
      "currencyCode": "USD"
    },
    "condition": "NEW",
    "gtins": [
      "9780007350896"
    ],
    "imageLink": "https://www.example.com/image/SKU12345"
  }
}

এই উদাহরণটি একটি পণ্যের titleavailability আপডেট করে এবং এর imageLink মুছে দেয়। পণ্যের description এবং price updateMask এর অন্তর্ভুক্ত নয় এবং অপরিবর্তিত থাকবে।

PATCH https://merchantapi.googleapis.com/products/v1/accounts/{ACCOUNT_ID}/productInputs/en~US~SKU12345?updateMask=productAttributes.title,productAttributes.availability,productAttributes.imageLink&dataSource=accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}
{
 "productAttributes": {
   "title": "Classic Cotton T-Shirt - New Edition",
   "availability": "OUT_OF_STOCK",
    "description": "A comfortable T-shirt from premium cotton, newer edition.",
    "price": {
      "amountMicros": "9990000",
      "currencyCode": "USD"
    }
 }
}

একটি সফল কল আপডেট করা ProductInput রিসোর্সটি ফেরত দেয়। title এবং availability আপডেট করা হয়, এবং imageLink টি সরিয়ে ফেলা হয় কারণ এটি updateMask এ থাকলেও রিকোয়েস্ট বডিতে ছিল না। description এবং price অপরিবর্তিত থাকে, কারণ সেগুলো updateMask এ তালিকাভুক্ত ছিল না।

{
  "name": "accounts/{ACCOUNT_ID}/productInputs/en~US~SKU12345",
  "product": "accounts/{ACCOUNT_ID}/products/en~US~SKU12345",
  "offerId": "SKU12345",
  "contentLanguage": "en",
  "feedLabel": "US",
  "productAttributes": {
    "title": "Classic Cotton T-Shirt - New Edition",
    "description": "A comfortable, durable, and stylish t-shirt made from 100% cotton.",
    "link": "https://www.example.com/p/SKU12345",
    "availability": "OUT_OF_STOCK",
    "price": {
      "amountMicros": "15990000",
      "currencyCode": "USD"
    },
    "condition": "NEW",
    "gtins": [
      "9780007350896"
    ],
  }
}

নিম্নলিখিত কোড নমুনাগুলিতে দেখানো হয়েছে কীভাবে একটি পণ্য আপডেট করতে হয়।

জাভা

import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.protobuf.FieldMask;
import com.google.shopping.merchant.datasources.v1.DataSourceName;
import com.google.shopping.merchant.products.v1.Availability;
import com.google.shopping.merchant.products.v1.Condition;
import com.google.shopping.merchant.products.v1.ProductAttributes;
import com.google.shopping.merchant.products.v1.ProductInput;
import com.google.shopping.merchant.products.v1.ProductInputName;
import com.google.shopping.merchant.products.v1.ProductInputsServiceClient;
import com.google.shopping.merchant.products.v1.ProductInputsServiceSettings;
import com.google.shopping.merchant.products.v1.UpdateProductInputRequest;
import com.google.shopping.type.CustomAttribute;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/** This class demonstrates how to update a product input */
public class UpdateProductInputSample {

  public static void updateProductInput(Config config, String productId, String dataSourceId)
      throws Exception {

    // Obtains OAuth token based on the user's configuration.
    GoogleCredentials credential = new Authenticator().authenticate();

    // Creates service settings using the credentials retrieved above.
    ProductInputsServiceSettings productInputsServiceSettings =
        ProductInputsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    // Creates product name to identify product.
    String name =
        ProductInputName.newBuilder()
            .setAccount(config.getAccountId().toString())
            .setProductinput(productId)
            .build()
            .toString();

    // Just productAttributes and customAttributes can be updated
    FieldMask fieldMask =
        FieldMask.newBuilder()
            .addPaths("product_attributes.title")
            .addPaths("product_attributes.description")
            .addPaths("product_attributes.link")
            .addPaths("product_attributes.image_link")
            .addPaths("product_attributes.availability")
            .addPaths("product_attributes.condition")
            .addPaths("product_attributes.gtins")
            .addPaths("custom_attributes.mycustomattribute")
            .build();

    // Calls the API and catches and prints any network failures/errors.
    try (ProductInputsServiceClient productInputsServiceClient =
        ProductInputsServiceClient.create(productInputsServiceSettings)) {

      ProductAttributes attributes =
          ProductAttributes.newBuilder()
              .setTitle("A Tale of Two Cities")
              .setDescription("A classic novel about the French Revolution")
              .setLink("https://exampleWebsite.com/tale-of-two-cities.html")
              .setImageLink("https://exampleWebsite.com/tale-of-two-cities.jpg")
              .setAvailability(Availability.IN_STOCK)
              .setCondition(Condition.NEW)
              .addGtins("9780007350896")
              .build();

      // The datasource can be either a primary or supplemental datasource.
      String dataSource =
          DataSourceName.newBuilder()
              .setAccount(config.getAccountId().toString())
              .setDatasource(dataSourceId)
              .build()
              .toString();

      UpdateProductInputRequest request =
          UpdateProductInputRequest.newBuilder()
              .setUpdateMask(fieldMask)
              // You can only update product attributes and custom_attributes
              .setDataSource(dataSource)
              .setProductInput(
                  ProductInput.newBuilder()
                      .setName(name)
                      .setProductAttributes(attributes)
                      .addCustomAttributes(
                          CustomAttribute.newBuilder()
                              .setName("mycustomattribute")
                              .setValue("Example value")
                              .build())
                      .build())
              .build();

      System.out.println("Sending update ProductInput request");
      ProductInput response = productInputsServiceClient.updateProductInput(request);
      System.out.println("Updated ProductInput Name below");
      // The last part of the product name will be the product ID assigned to a product by Google.
      // Product ID has the format `contentLanguage~feedLabel~offerId`
      System.out.println(response.getName());
      System.out.println("Updated Product below");
      System.out.println(response);
    } catch (Exception e) {
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();
    // An ID assigned to a product by Google. In the format
    // contentLanguage~feedLabel~offerId
    String productId = "en~label~sku123"; // Replace with your product ID.

    // Identifies the data source that will own the product input.
    String dataSourceId = "{INSERT_DATASOURCE_ID}"; // Replace with your datasource ID.

    updateProductInput(config, productId, dataSourceId);
  }
}

পিএইচপি

use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;
use Google\Shopping\Merchant\Products\V1\Availability;
use Google\Shopping\Merchant\Products\V1\Condition;
use Google\Shopping\Merchant\Products\V1\ProductAttributes;
use Google\Shopping\Merchant\Products\V1\Client\ProductInputsServiceClient;
use Google\Shopping\Merchant\Products\V1\ProductInput;
use Google\Shopping\Merchant\Products\V1\UpdateProductInputRequest;
use Google\Shopping\Type\CustomAttribute;

/**
 * This class demonstrates how to update a product input.
 */
class UpdateProductInputSample
{
    // An ID assigned to a product by Google. In the format
    // contentLanguage~feedLabel~offerId
    // Please ensure this product ID exists for the update to succeed.
    private const PRODUCT_ID = "online~en~label~sku123";

    // Identifies the data source that will own the product input.
    // Please ensure this data source ID exists.
    private const DATASOURCE_ID = "<INSERT_DATASOURCE_ID>";

    /**
     * Helper function to construct the full product input resource name.
     *
     * @param string $accountId The merchant account ID.
     * @param string $productInputId The product input ID (e.g., "online~en~label~sku123").
     * @return string The full product input resource name.
     */
    private static function getProductInputName(string $accountId, string $productInputId): string
    {
        return sprintf("accounts/%s/productInputs/%s", $accountId, $productInputId);
    }

    /**
     * Helper function to construct the full data source resource name.
     *
     * @param string $accountId The merchant account ID.
     * @param string $dataSourceId The data source ID.
     * @return string The full data source resource name.
     */
    private static function getDataSourceName(string $accountId, string $dataSourceId): string
    {
        return sprintf("accounts/%s/dataSources/%s", $accountId, $dataSourceId);
    }

    /**
     * Updates an existing product input in your Merchant Center account.
     *
     * @param array $config The configuration array containing the account ID.
     * @param string $productId The ID of the product input to update.
     * @param string $dataSourceId The ID of the data source.
     */
    public static function updateProductInput(
        array $config,
        string $productId,
        string $dataSourceId
    ): void {
        // Gets the OAuth credentials to make the request.
        $credentials = Authentication::useServiceAccountOrTokenFile();

        // Creates options config containing credentials for the client to use.
        $options = ['credentials' => $credentials];

        // Creates a ProductInputsServiceClient.
        $productInputsServiceClient = new ProductInputsServiceClient($options);

        // Construct the full resource name of the product input to be updated.
        $name = self::getProductInputName($config['accountId'], $productId);

        // Define the FieldMask to specify which fields to update.
        // Only 'attributes' and 'custom_attributes' can be specified in the
        // FieldMask for product input updates.
        $fieldMask = new FieldMask([
            'paths' => [
                "product_attributes.title",
                "product_attributes.description",
                "product_attributes.link",
                "product_attributes.image_link",
                "product_attributes.availability",
                "product_attributes.condition",
                "product_attributes.gtin",
                "custom_attributes.mycustomattribute" // Path for a specific custom attribute
            ]
        ]);

        // Calls the API and handles any network failures or errors.
        try {
            // Define the new attributes for the product.
            $attributes = new ProductAttributes([
                'title' => 'A Tale of Two Cities 3',
                'description' => 'A classic novel about the French Revolution',
                'link' => 'https://exampleWebsite.com/tale-of-two-cities.html',
                'image_link' => 'https://exampleWebsite.com/tale-of-two-cities.jpg',
                'availability' => Availability::IN_STOCK,
                'condition' => Condition::PBNEW,
                'gtins' => ['9780007350896'] // GTIN is a repeated field.
            ]);

            // Construct the full data source name.
            // This specifies the data source context for the update.
            $dataSource = self::getDataSourceName($config['accountId'], $dataSourceId);

            // Create the ProductInput object with the desired updates.
            // The 'name' field must match the product input being updated.
            $productInput = new ProductInput([
                'name' => $name,
                'product_attributes' => $attributes,
                'custom_attributes' => [ // Provide the list of custom attributes.
                    new CustomAttribute([
                        'name' => 'mycustomattribute',
                        'value' => 'Example value'
                    ])
                ]
            ]);

            // Create the UpdateProductInputRequest.
            $request = new UpdateProductInputRequest([
                'update_mask' => $fieldMask,
                'data_source' => $dataSource,
                'product_input' => $productInput
            ]);

            print "Sending update ProductInput request\n";
            // Make the API call to update the product input.
            $response = $productInputsServiceClient->updateProductInput($request);

            print "Updated ProductInput Name below\n";
            // The name of the updated product input.
            // The last part of the product name is the product ID (e.g., contentLanguage~feedLabel~offerId).
            print $response->getName() . "\n";
            print "Updated Product below\n";
            // Print the full updated product input object.
            print_r($response);

        } catch (ApiException $e) {
            printf("ApiException caught: %s\n", $e->getMessage());
        }
    }

    /**
     * Executes the UpdateProductInput sample.
     */
    public function callSample(): void
    {
        $config = Config::generateConfig();
        $productId = self::PRODUCT_ID;
        $dataSourceId = self::DATASOURCE_ID;

        self::updateProductInput($config, $productId, $dataSourceId);
    }
}

// Run the script.
$sample = new UpdateProductInputSample();
$sample->callSample();

পাইথন

"""A module to update a product input."""

from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.protobuf import field_mask_pb2
from google.shopping.merchant_products_v1 import Availability
from google.shopping.merchant_products_v1 import Condition
from google.shopping.merchant_products_v1 import ProductAttributes
from google.shopping.merchant_products_v1 import ProductInput
from google.shopping.merchant_products_v1 import ProductInputsServiceClient
from google.shopping.merchant_products_v1 import UpdateProductInputRequest
from google.shopping.type import CustomAttribute


# Fetches the Merchant Center account ID from the authentication examples.
# This ID is needed to construct resource names for the API.
_ACCOUNT_ID = configuration.Configuration().read_merchant_info()


def update_product_input(account_id: str, product_id: str, data_source_id: str):
  """Updates an existing product input for a specific account.

  Args:
    account_id: The Merchant Center account ID.
    product_id: The ID of the product input to update. This ID is assigned by
      Google and has the format `contentLanguage~feedLabel~offerId`.
    data_source_id: The ID of the data source that owns the product input.
  """

  # Obtains OAuth credentials for authentication.
  credentials = generate_user_credentials.main()

  # Creates a ProductInputsServiceClient instance.
  client = ProductInputsServiceClient(credentials=credentials)

  # Constructs the full resource name for the product input.
  # Format: accounts/{account}/productInputs/{productinput}
  name = f"accounts/{account_id}/productInputs/{product_id}"

  # Defines the FieldMask to specify which fields of the product input
  # are being updated. Only 'attributes' and 'custom_attributes' can be updated.
  field_mask = field_mask_pb2.FieldMask(
      paths=[
          "product_attributes.title",
          "product_attributes.description",
          "product_attributes.link",
          "product_attributes.image_link",
          "product_attributes.availability",
          "product_attributes.condition",
          "product_attributes.gtins",
          "custom_attributes.mycustomattribute",
      ]
  )

  # Prepares the new attribute values for the product.
  attributes = ProductAttributes(
      title="A Tale of Two Cities updated",
      description="A classic novel about the French Revolution",
      link="https://exampleWebsite.com/tale-of-two-cities.html",
      image_link="https://exampleWebsite.com/tale-of-two-cities.jpg",
      availability=Availability.IN_STOCK,
      condition=Condition.NEW,
      gtins=["9780007350896"],  # GTIN is a repeated field.
  )

  # Constructs the full resource name for the data source.
  # The data source can be primary or supplemental.
  # Format: accounts/{account}/dataSources/{datasource}
  data_source = f"accounts/{account_id}/dataSources/{data_source_id}"

  # Prepares the ProductInput object with the updated information.
  product_input_data = ProductInput(
      name=name,
      product_attributes=attributes,
      custom_attributes=[
          CustomAttribute(
              name="mycustomattribute", value="Example value"
          )
      ],
  )

  # Creates the UpdateProductInputRequest.
  request = UpdateProductInputRequest(
      update_mask=field_mask,
      data_source=data_source,
      product_input=product_input_data,
  )

  # Sends the update request to the API.
  try:
    print("Sending update ProductInput request")
    response = client.update_product_input(request=request)
    print("Updated ProductInput Name below")
    # The response includes the name of the updated product input.
    # The last part of the product name is the product ID assigned by Google.
    print(response.name)
    print("Updated Product below")
    print(response)
  except RuntimeError as e:
    # Catches and prints any errors that occur during the API call.
    print(e)


if __name__ == "__main__":
  # The ID of the product to be updated.
  # This ID is assigned by Google and typically follows the format:
  # contentLanguage~feedLabel~offerId
  # Replace with an actual product ID from your Merchant Center account.
  product_id_to_update = "online~en~label~sku123"

  # The ID of the data source that will own the updated product input.
  # Replace with an actual data source ID from your Merchant Center account.
  data_source_id_for_update = "<INSERT_DATA_SOURCE_ID>"

  update_product_input(
      _ACCOUNT_ID, product_id_to_update, data_source_id_for_update
  )

cURL

curl --location --request PATCH 'https://merchantapi.googleapis.com/products/v1/accounts/{ACCOUNT_ID}/productInputs/en~US~SKU12345?updateMask=productAttributes.title,productAttributes.description&dataSource=accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}' \
--header 'Authorization: Bearer <API_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
   "productAttributes": {
       "title": "A Tale of Two Cities",
       "description": "A classic novel about the French Revolution"
   }
}'

কাস্টম অ্যাট্রিবিউট ব্যবহার করে আপডেট করুন

আপনি একটিমাত্র কলে স্ট্যান্ডার্ড এবং কাস্টম অ্যাট্রিবিউট উভয়ই আপডেট করতে পারেন। একটি কাস্টম অ্যাট্রিবিউট আপডেট করতে, updateMask এ এর নামের আগে customAttributes যোগ করুন।

এই উদাহরণটি একটি অনুরোধেই একাধিক কাজ সম্পাদন করে:

  • সরাসরি স্ট্যান্ডার্ড title অ্যাট্রিবিউট আপডেট করে।
  • বিদ্যমান কাস্টম অ্যাট্রিবিউট ( myCustomAttrToBeUpdated ) আপডেট করে।
  • একটি নতুন কাস্টম অ্যাট্রিবিউট ( myCustomAttrToBeInserted ) যোগ করে।
  • বিদ্যমান কাস্টম অ্যাট্রিবিউট ( myCustomAttrToBeDeleted ) মুছে ফেলে।
PATCH https://merchantapi.googleapis.com/products/v1/accounts/{ACCOUNT_ID}/productInputs/en~US~SKU12345?updateMask=productAttributes.title,customAttributes.myCustomAttrToBeInserted,customAttributes.myCustomAttrToBeUpdated,customAttributes.myCustomAttrToBeDeleted&dataSource=accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}
{
  "productAttributes": {
    "title": "ProductTitle Updated"
  },
  "customAttributes": [
    {
      "name": "description",
      "value": "A newly updated description."
    },
    {
      "name": "myCustomAttrToBeUpdated",
      "value": "myCustomAttrToBeUpdated updated value"
    },
    {
      "name": "myCustomAttrToBeInserted",
      "value": "new from update"
    }
  ]
}

একটি সফল অনুরোধ নির্দিষ্ট সমস্ত পরিবর্তন প্রতিফলিত করে হালনাগাদ করা ProductInput ফেরত দেয়।

কাস্টম অ্যাট্রিবিউট আপডেটগুলি বুঝুন

আপনি নিজে সংজ্ঞায়িত করা অ্যাট্রিবিউটগুলো আপডেট করতে customAttributes ফিল্ডটি ব্যবহার করতে পারেন। এগুলো স্ট্যান্ডার্ড স্পেসিফিকেশনের সাথে মেলে না এবং চূড়ান্ত পণ্যে কাস্টম অ্যাট্রিবিউট হিসেবে সংরক্ষিত হবে।

পণ্য আপডেটগুলি কীভাবে প্রক্রিয়া করা হয়

যখন আপনি একটি patch অনুরোধ পাঠান, তখন কোনো নিয়ম প্রয়োগ করার আগেই নির্দিষ্ট ProductInput ডেটাতে আপডেটটি প্রয়োগ করা হয়। এর ফলে পণ্য সন্নিবেশ এবং আপডেট করার ক্ষেত্রে একটি সামঞ্জস্যপূর্ণ আচরণ বজায় থাকে।

আপনার আপডেটটি যেভাবে সম্পন্ন করা হয়:

  1. ইনপুট আপডেট: আপনার patch অনুরোধটি আপনার সরবরাহ করা ডেটা সোর্সের সাথে যুক্ত নির্দিষ্ট ProductInput টিকে পরিবর্তন করে।

  2. প্রক্রিয়াকরণ ও একত্রীকরণ: ইনপুট আপডেট করার পর, প্রক্রিয়াকরণ শুরু হয়:

    • ফিড রুলস এবং সাপ্লিমেন্টাল ডেটা সোর্স: প্রোডাক্টের প্রাইমারি সোর্সে কনফিগার করা রুলগুলো প্রাইমারি এবং সাপ্লিমেন্টাল সোর্স থেকে ProductInput একত্রিত করে। এই রুলগুলো অ্যাট্রিবিউট পরিবর্তন করতে বা নতুন অ্যাট্রিবিউট তৈরি করতে পারে। রুলগুলো সেট আপ করার বিষয়ে আরও জানতে, "আপনার অ্যাট্রিবিউট রুল সেট আপ করুন" দেখুন।
    • অন্যান্য ডেটা উৎস: অন্যান্য উৎস থেকে প্রাপ্ত ডেটাও (উদাহরণস্বরূপ, স্বয়ংক্রিয় উন্নতি) প্রাথমিক ডেটা উৎসের ইনপুটের সাথে একত্রিত করা হয়।
    • যাচাইকরণ: একত্রিত ডেটা পণ্যের ডেটা স্পেসিফিকেশন এবং গুগলের শপিং নীতিমালার সাথে মিলিয়ে যাচাই করা হয়।
  3. চূড়ান্ত পণ্য: এই পাইপলাইনের ফলাফল হলো চূড়ান্ত, প্রক্রিয়াজাত Product রিসোর্স যা products.get বা products.list ব্যবহার করে ফেরত পাওয়া যায়। এটিই পণ্যের সেই সংস্করণ যা মার্চেন্ট সেন্টারে দেখানো হয় এবং বিভিন্ন গন্তব্যে প্রদর্শিত হওয়ার যোগ্য।

এই বহু-ধাপ প্রক্রিয়ার কারণে, আপনি যখন একটি আপডেট অনুরোধ পাঠান এবং products.get ব্যবহার করে প্রাপ্ত চূড়ান্ত Product রিসোর্সে পরিবর্তনগুলি প্রতিফলিত হতে সাধারণত কয়েক মিনিটের একটি বিলম্ব হয়।

উদাহরণ: একটিমাত্র প্রাথমিক ইনপুট দিয়ে কোনো পণ্য আপডেট করা

এটি সবচেয়ে সাধারণ ব্যবহারের ক্ষেত্র। একটি পণ্য একটিমাত্র প্রাথমিক ডেটা উৎসে বিদ্যমান থাকে এবং আপনি এর কিছু অ্যাট্রিবিউট আপডেট করতে চান।

  1. প্রাথমিক অবস্থা: আপনার প্রাথমিক ডেটা উৎসে en~US~SKU12345 একটি পণ্য বিদ্যমান, যার title: "Classic T-Shirt" এবং price: 15.99 USD
  2. আপডেট অনুরোধ: আপনি price 14.99 USD আপডেট করতে এবং availability out of stock হিসেবে সেট করতে একটি patch অনুরোধ পাঠিয়েছেন।
  3. প্রক্রিয়াকরণ:
    • SKU12345 এর জন্য ProductInput আপডেট করা হয়েছে।
  4. চূড়ান্ত পণ্য: চূড়ান্ত Product বর্তমান title: "Classic T-Shirt" , price: 14.99 USD , এবং availability: "out of stock"

উদাহরণ: সম্পূরক ডেটা এবং নিয়মাবলী দিয়ে একটি পণ্য আপডেট করা

এই উদাহরণটি দেখায় কিভাবে ফিড রুলগুলো একটি আপডেটকে প্রভাবিত করতে পারে, যার ফলে কিছু পরিবর্তন প্রয়োগ হওয়ার পাশাপাশি অন্যগুলো বাতিল হয়ে যায়।

  1. প্রাথমিক অবস্থা:
    • প্রাথমিক ইনপুট: en~US~SKU12345 title: "Great T-Shirt" এবং description: "A great short-sleeve t-shirt."
    • সম্পূরক ইনপুট: একই পণ্যটির একটি সম্পূরক ডেটা উৎসে title: "Awesome T-Shirt" এবং description: "An awesome short-sleeve t-shirt." একটি এন্ট্রি রয়েছে।
    • ফিড নিয়ম: সম্পূরক ডেটা উৎস থেকে title নেওয়ার জন্য একটি নিয়ম সেট করা আছে। description জন্য কোনো নিয়ম নেই।
    • ফলাফল: চূড়ান্তভাবে প্রক্রিয়াজাত Product title: "Awesome T-Shirt" এবং description: "A great short-sleeve t-shirt."
  2. আপডেট অনুরোধ: আপনি প্রাথমিক ডেটা উৎসটি আপডেট করার জন্য একটি patch অনুরোধ পাঠিয়েছেন, যেখানে title "Fantastic T-Shirt" এবং description "A fantastic short-sleeve t-shirt." হিসেবে সেট করা হবে।
  3. প্রক্রিয়াকরণ:
    • প্রাথমিক ডেটা সোর্সের ProductInput টি আপডেট করে title: "Fantastic T-Shirt" এবং description: "A fantastic short-sleeve t-shirt." করা হয়েছে।
    • প্রসেসিং পাইপলাইনটি চলে।
    • title ক্ষেত্রে, ফিড নিয়ম অনুযায়ী সম্পূরক ডেটা উৎস ( Awesome T-Shirt ) থেকে প্রাপ্ত মানটি অগ্রাধিকার পাবে এবং আপনার আপডেটটিকে অগ্রাহ্য করবে।
    • description জন্য, যেহেতু কোনো অগ্রাহ্যকারী নিয়ম নেই, তাই প্রাথমিক ইনপুট ( A fantastic short-sleeve t-shirt. ) থেকে হালনাগাদ করা মানটি ব্যবহার করা হয়।
  4. চূড়ান্ত পণ্য: চূড়ান্ত Product শিরোনাম Awesome T-Shirt (আপনার আপডেটটি বাতিল করা হয়েছে) অপরিবর্তিত রয়েছে, কিন্তু এর বিবরণ এখন A fantastic short-sleeve t-shirt. (আপনার আপডেটটি প্রয়োগ করা হয়েছে)।

আপডেট এবং সম্পূরক ডেটা উৎসের মধ্যে নির্বাচন করুন

আপনি productinputs.patch ব্যবহার করে অথবা সম্পূরক ডেটা উৎসগুলিতে ডেটা সন্নিবেশ করে পণ্যের ডেটা পরিবর্তন করতে পারেন। সেরা উপায়টি আপনার ডেটা ব্যবস্থাপনা কৌশলের উপর নির্ভর করে।

অপ্রত্যাশিত ফলাফল এড়ানোর জন্য, আমরা সুপারিশ করি যে আপনি একই পণ্যের জন্য একই পণ্যের ডেটা পরিচালনা করতে productinputs.patch এবং সম্পূরক ডেটা উৎস উভয়ই ব্যবহার করবেন না।

এখানে একটি বিস্তারিত তুলনা দেওয়া হলো:

বৈশিষ্ট্য productinputs.patch (আপডেট) পরিপূরক ডেটা উৎস
সেরা বিদ্যমান ডেটাতে (যেমন, মূল্য, প্রাপ্যতা) দ্রুত, ঘন ঘন এবং আংশিক পরিবর্তন। যৌক্তিকভাবে ডেটা স্তরবিন্যাস করা, বিভিন্ন সিস্টেম দ্বারা ভিন্ন ভিন্ন অ্যাট্রিবিউট পরিচালনা করা, অথবা জটিল নিয়ম-ভিত্তিক ওভাররাইড।
প্রক্রিয়া বিদ্যমান ProductInput যথাস্থানে পরিবর্তন করে। একটি সম্পূরক ডেটা সোর্সে একটি নতুন, পৃথক ProductInput তৈরি করে।
ডেটার সূক্ষ্মতা একটিমাত্র ProductInput এর নির্দিষ্ট ফিল্ডগুলোর ওপর কাজ করে। সম্পূরক উৎসের অন্তর্গত সম্পূর্ণ ProductInput উপর এটি কাজ করে।
অধ্যবসায় একই ProductInput একটি সম্পূর্ণ insert বা অন্য কোনো patch দ্বারা ওভাররাইট না করা পর্যন্ত পরিবর্তনগুলি স্থায়ী থাকে। স্থায়িত্ব ফিড রুল দ্বারা নিয়ন্ত্রিত হয়। রুলগুলো অগ্রাধিকার দিলে এটি অনির্দিষ্টকালের জন্য প্রাথমিক ডেটাকে অগ্রাহ্য করতে পারে।
নিয়ম মিথস্ক্রিয়া এটি ফিড রুল ছাড়াই ব্যবহার করা যায়, কারণ এটি একটি বিদ্যমান ডেটা সোর্স ও ProductInput আপডেট করে। পরিপূরক উৎসটিকে লিঙ্ক করার জন্য মূল উৎসে সুস্পষ্টভাবে একটি নিয়ম সেট আপ করতে হবে।
ডেটা উৎস সেটআপ বিদ্যমান ডেটা উৎসের উপর কাজ করে। কোনো নতুন উৎসের প্রয়োজন নেই। এর জন্য আলাদা সম্পূরক ডেটা উৎস তৈরি ও পরিচালনা করতে হবে এবং ফিড নিয়ম ব্যবহার করে সেগুলোকে সংযুক্ত করতে হবে।