একটি গুগল বিজনেস প্রোফাইল লিঙ্ক করুন

একটি গুগল বিজনেস গ্রুপ হলো আপনার লোকেশনগুলোর জন্য একটি শেয়ার্ড ফোল্ডারের মতো। একটি বিজনেস গ্রুপ একাধিক ব্যবহারকারীর সাথে আপনার লোকেশনগুলোর ব্যবস্থাপনা শেয়ার করার একটি নিরাপদ উপায় প্রদান করে। আরও তথ্যের জন্য, বিজনেস গ্রুপ সম্পর্কে দেখুন।

আপনার স্থানীয় ইনভেন্টরি আপলোড করার আগে, সেই বিজনেস গ্রুপটি নির্দিষ্ট করুন যার দায়িত্বে আপনার মার্চেন্ট সেন্টার অ্যাকাউন্টটি থাকবে। আপনি মার্চেন্ট এপিআই (Merchant API) ব্যবহার করে বিজনেস প্রোফাইল থেকে যোগ্য বিজনেস গ্রুপগুলোর তালিকা পেতে পারেন, কিন্তু অ্যাক্সেস পেতে হলে আপনাকে প্রথমে আপনার অ্যাকাউন্টটি একটি বিজনেস প্রোফাইলের সাথে লিঙ্ক করতে হবে।

ব্যবসায়িক প্রোফাইলে অ্যাক্সেসের জন্য অনুরোধ করুন

একটি ব্যবসায়িক প্রোফাইলে প্রবেশাধিকার পেতে, gbpAccounts.LinkGbpAccount পদ্ধতিটি ব্যবহার করুন:

POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/gbpAccounts:linkGbpAccount

{
  "gbpEmail": "admin@example.com",
}

নিম্নলিখিতগুলি প্রতিস্থাপন করুন:

  • ACCOUNT_ID : আপনার মার্চেন্ট সেন্টার অ্যাকাউন্টের অনন্য শনাক্তকারী
  • GBP_EMAIL : ব্যবসায়িক প্রোফাইলের প্রশাসকের ইমেল

এই মেথডটি কল করা হলে, সার্ভিসটি নির্দিষ্ট অ্যাডমিনিস্ট্রেটরকে একটি ইমেল পাঠায়, যেখানে অ্যাক্সেসের অনুরোধটি গ্রহণ বা প্রত্যাখ্যান করতে বলা হয়। যদি অ্যাডমিনিস্ট্রেটর ৭ দিনের মধ্যে কোনো উত্তর না দেন, তাহলে অনুরোধটি স্বয়ংক্রিয়ভাবে বাতিল হয়ে যায়।

উপলব্ধ ব্যবসায়িক গোষ্ঠীগুলির তালিকা করুন

প্রশাসক অনুরোধটি অনুমোদন করলে, আপনি gbpAccounts.List পদ্ধতিটি ব্যবহার করে উপলব্ধ ব্যবসায়িক গ্রুপগুলি পরীক্ষা করতে পারবেন।

এখানে একটি নমুনা অনুরোধ এবং তার সফল প্রতিক্রিয়া দেওয়া হলো:

GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/gbpAccounts

Response:
200 OK
{
  "gbpAccounts": [
    {
      "name": "accounts/{ACCOUNT_ID}/gbpAccounts/12345",
      "gbpAccountId": 12345,
      "type": USER,
      "gbpAccountName": "admin@example.com",
      "listingCount": 15
    }, {
      "name": "accounts/{ACCOUNT_ID}/gbpAccounts/67890",
      "gbpAccountId": 67890,
      "type": BUSINESS_ACCOUNT,
      "gbpAccountName": "Google My Business Account",
      "listingCount": 23
    }
  ],
  "nextPageToken": 50
}

সমস্ত যোগ্য ব্যবসায়িক গ্রুপ পুনরুদ্ধার করতে আপনি এই কোড নমুনাটি ব্যবহার করতে পারেন:

জাভা

import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.AccountName;
import com.google.shopping.merchant.accounts.v1.GbpAccount;
import com.google.shopping.merchant.accounts.v1.GbpAccountsServiceClient;
import com.google.shopping.merchant.accounts.v1.GbpAccountsServiceClient.ListGbpAccountsPagedResponse;
import com.google.shopping.merchant.accounts.v1.GbpAccountsServiceSettings;
import com.google.shopping.merchant.accounts.v1.ListGbpAccountsRequest;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/**
 * This class demonstrates how to get the list of GBP accounts for a given Merchant Center account
 */
public class ListGbpAccountsSample {

  public static void listGbpAccounts(Config config) throws Exception {

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

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

    String accountId = config.getAccountId().toString();
    // Creates parent to identify the omnichannelSetting from which to list all Lfp Providers.
    String parent = AccountName.newBuilder().setAccount(accountId).build().toString();

    // Calls the API and catches and prints any network failures/errors.
    try (GbpAccountsServiceClient gbpAccountsServiceClient =
        GbpAccountsServiceClient.create(gbpAccountsServiceSettings)) {
      ListGbpAccountsRequest request =
          ListGbpAccountsRequest.newBuilder().setParent(parent).build();

      System.out.println("Sending list GBP accounts request:");
      ListGbpAccountsPagedResponse response = gbpAccountsServiceClient.listGbpAccounts(request);

      int count = 0;

      // Iterates over all the entries in the response.
      for (GbpAccount gbpAccount : response.iterateAll()) {
        System.out.println(gbpAccount);
        count++;
      }
      System.out.println(String.format("The following count of elements were returned: %d", count));
    } catch (Exception e) {
      System.out.println("An error has occured: ");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();

    listGbpAccounts(config);
  }
}

পিএইচপি

require_once __DIR__ . '/../../../../vendor/autoload.php';
require_once __DIR__ . '/../../../Authentication/Authentication.php';
require_once __DIR__ . '/../../../Authentication/Config.php';

use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\Client\GbpAccountsServiceClient;
use Google\Shopping\Merchant\Accounts\V1\GbpAccount;
use Google\Shopping\Merchant\Accounts\V1\ListGbpAccountsRequest;

/**
 * This class demonstrates how to get the list of GBP accounts for a given
 * Merchant Center account.
 */
class ListGbpAccountsSample
{
    /**
     * A helper function to create the parent string.
     *
     * @param string $accountId The account ID.
     *
     * @return string The parent has the format: `accounts/{account_id}`
     */
    private static function getParent(string $accountId): string
    {
        return sprintf('accounts/%s', $accountId);
    }

    /**
     * Retrieves the list of GBP accounts for a given Merchant Center account.
     *
     * @param array $config The configuration data for authentication and account ID.
     *
     * @return void
     */
    public static function listGbpAccounts(array $config): 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 client.
        $gbpAccountsServiceClient = new GbpAccountsServiceClient($options);

        // Creates the parent account name to identify the merchant.
        $parent = self::getParent($config['accountId']);

        // Creates the request to list GBP accounts.
        $request = new ListGbpAccountsRequest([
            'parent' => $parent
        ]);

        // Calls the API and catches and prints any network failures/errors.
        try {
            printf("Sending list GBP accounts request:%s", PHP_EOL);
            $response = $gbpAccountsServiceClient->listGbpAccounts($request);

            $count = 0;

            // Iterates over all the GBP accounts in the response and prints them.
            foreach ($response->iterateAllElements() as $gbpAccount) {
                /** @var GbpAccount $gbpAccount */
                print_r($gbpAccount->serializeToJsonString());
                $count++;
            }
            printf(
                "The following count of elements were returned: %d%s",
                $count,
                PHP_EOL
            );
        } catch (ApiException $e) {
            printf("An error has occurred: %s%s", $e->getMessage(), PHP_EOL);
        }
    }

    /**
     * Helper to execute the sample.
     *
     * @return void
     */
    public function callSample(): void
    {
        $config = Config::generateConfig();
        self::listGbpAccounts($config);
    }
}

// Runs the script.
$sample = new ListGbpAccountsSample();
$sample->callSample();

পাইথন

from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import GbpAccountsServiceClient
from google.shopping.merchant_accounts_v1 import ListGbpAccountsRequest

# Gets the merchant account ID from the configuration file.
_ACCOUNT = configuration.Configuration().read_merchant_info()
# Creates the parent resource name string.
_PARENT = f"accounts/{_ACCOUNT}"


def list_gbp_accounts() -> None:
  """Lists the Google Business Profile accounts for a given Merchant Center account."""

  # Gets OAuth Credentials.
  credentials = generate_user_credentials.main()

  # Creates a client.
  client = GbpAccountsServiceClient(credentials=credentials)

  # Creates the request.
  request = ListGbpAccountsRequest(parent=_PARENT)

  # Makes the request and catches and prints any error messages.
  try:
    print("Sending list GBP accounts request:")
    # Makes the request and retrieves the list of GBP accounts.
    response = client.list_gbp_accounts(request=request)

    count = 0
    # Iterates over all the GBP accounts in the response and prints them.
    for gbp_account in response:
      print(gbp_account)
      count += 1
    print(f"The following count of elements were returned: {count}")
  except RuntimeError as e:
    print("An error has occured: ")
    print(e)


if __name__ == "__main__":
  list_gbp_accounts()

মার্চেন্ট সেন্টার অ্যাকাউন্টের জন্য ব্যবসায়িক গোষ্ঠী নির্দিষ্ট করুন।

উপলব্ধ বিজনেস গ্রুপগুলির তালিকা থেকে, আপনি আপনার মার্চেন্ট সেন্টার অ্যাকাউন্টের সাথে বিজনেস গ্রুপটি যুক্ত করতে পারেন। উদাহরণস্বরূপ, যদি আপনি GBP অ্যাকাউন্ট আইডি 12345 (যা পূর্ববর্তী ধাপ থেকে প্রাপ্ত) সহ বিজনেস গ্রুপটি বেছে নিতে চান, তাহলে আপনি AccountServices.proposeAccountService ব্যবহার করতে পারেন:

POST
https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/services:propose
{
  provider: "providers/GOOGLE_BUSINESS_PROFILE",
  account_service: {
    external_account_id: "12345",
    local_listing_management {}
  }
}

মনে রাখবেন যে provider ফিল্ডটি অবশ্যই providers/GOOGLE_BUSINESS_PROFILE হতে হবে। আপনাকে অনুরোধে LocalListingManagement ফিল্ডটি অবশ্যই খালি রাখতে হবে।

পণ্য এবং মজুদের তথ্য জমা দিন

এখন যেহেতু আপনি আপনার মার্চেন্ট সেন্টার অ্যাকাউন্টটি একটি ব্যবসায়িক গোষ্ঠীর সাথে যুক্ত করেছেন, আপনি আপনার পণ্য এবং স্থানীয় মজুদের তথ্য আপলোড করতে পারেন। আরও তথ্যের জন্য দেখুন