স্থানীয় ফিড পার্টনারশিপ (LFP) প্রদানকারীদের পরিচালনা করুন

স্থানীয় ফিডস পার্টনারশিপ প্রোগ্রাম হল খুচরা বিক্রেতাদের তাদের নিজস্ব প্রাথমিক এবং স্থানীয় পণ্য ইনভেন্টরি ফিড তৈরি না করেই স্থানীয় ইনভেন্টরি বিজ্ঞাপন এবং বিনামূল্যের স্থানীয় তালিকায় অংশগ্রহণ করার একটি উপায়। বিশ্বস্ত ডেটা প্রদানকারীরা খুচরা বিক্রেতাদের পক্ষ থেকে Google-কে বিক্রয় বা ইনভেন্টরি ডেটা প্রদান করতে পারে।

পূর্বশর্ত

এই বিভাগে API পদ্ধতিগুলি ব্যবহার করতে, প্রথমে আপনার স্থানীয় ইনভেন্টরি বিজ্ঞাপন (LIA) বা বিনামূল্যে স্থানীয় তালিকা (FLL) প্রোগ্রামগুলি স্থাপন করুন৷ আরও বিশদ বিবরণের জন্য, omnichannel সেটিংস পরিচালনা দেখুন।

উপলব্ধ LFP প্রদানকারী খুঁজুন

একটি দেশে উপলব্ধ সমস্ত LFP প্রদানকারী পুনরুদ্ধার করতে, lfpProviders.findLfpProviders ব্যবহার করুন।

POST
https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{REGION_CODE}/lfpProviders:find

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

  • {ACCOUNT_ID} : আপনার Merchant Center অ্যাকাউন্টের অনন্য শনাক্তকারী
  • {REGION_CODE} : একটি অঞ্চল কোড, কমন লোকেল ডেটা রিপোজিটরি (CLDR) প্রকল্প দ্বারা সংজ্ঞায়িত তালিকা থেকে

একটি নমুনা সফল প্রতিক্রিয়া:

200 OK
{
  "lsfProviders": [
    {
      "name": "accounts/{ACCOUNT}/omnichannelSettings/{REGION_CODE}/lsfProviders/12345",
      "regionCode": {REGION_CODE},
      "displayName": "LFP Provider 1"
    }, {
      "name": "accounts/{ACCOUNT}/omnichannelSettings/{REGION_CODE}/lsfProviders/67890",
      "regionCode": {REGION_CODE},
      "displayName": "LFP Provider 6"
    }
  ],
  "nextPageToken": 50
}

এখানে একটি কোড নমুনা আছে:

package shopping.merchant.samples.accounts.v1;

// [START merchantapi_find_lfp_providers]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.FindLfpProvidersRequest;
import com.google.shopping.merchant.accounts.v1.LfpProvider;
import com.google.shopping.merchant.accounts.v1.LfpProvidersServiceClient;
import com.google.shopping.merchant.accounts.v1.LfpProvidersServiceClient.FindLfpProvidersPagedResponse;
import com.google.shopping.merchant.accounts.v1.LfpProvidersServiceSettings;
import com.google.shopping.merchant.accounts.v1.OmnichannelSettingName;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/** This class demonstrates how to get the Lfp Providers for a given Merchant Center account */
public class FindLfpProvidersSample {

  public static void findLfpProviders(Config config, String regionCode)
      throws Exception {

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

    // Creates service settings using the retrieved credentials.
    LfpProvidersServiceSettings lfpProvidersServiceSettings =
        LfpProvidersServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    // Gets the account ID from the config file.
    String accountId = config.getAccountId().toString();
    // Creates parent to identify the omnichannelSetting from which to list all Lfp Providers.
    String parent =
        OmnichannelSettingName.newBuilder()
            .setAccount(accountId)
            .setOmnichannelSetting(regionCode)
            .build()
            .toString();

    // Calls the API and catches and prints any network failures/errors.
    try (LfpProvidersServiceClient lfpProvidersServiceClient =
        LfpProvidersServiceClient.create(lfpProvidersServiceSettings)) {
      FindLfpProvidersRequest request =
          FindLfpProvidersRequest.newBuilder().setParent(parent).build();

      System.out.println("Sending find LFP providers request:");
      FindLfpProvidersPagedResponse response = lfpProvidersServiceClient.findLfpProviders(request);

      int count = 0;

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

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

    // The country you're targeting at.
    String regionCode = "{REGION_CODE}";

    findLfpProviders(config, regionCode);
  }
}
// [END merchantapi_find_lfp_providers]

একটি LFP অংশীদারিত্ব তৈরি করতে, lfpProviders.LinkLfpProvider ব্যবহার করুন:

POST
https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{REGION_CODE}/lfpProviders/{LFP_PROVIDER}:linkLfpProvider
{
  "externalAccountId": "{EXTERNAL_ACCOUNT_ID}",
}

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

  • {ACCOUNT_ID} : আপনার Merchant Center অ্যাকাউন্টের অনন্য শনাক্তকারী
  • {LFP_PROVIDER} : LFP প্রদানকারী আইডি আগের ধাপে ফিরে এসেছে। উদাহরণস্বরূপ, এটি LFP প্রদানকারী 1 এর জন্য 12345 হবে।
  • {EXTERNAL_ACCOUNT_ID} : বাহ্যিক অ্যাকাউন্ট আইডি যার মাধ্যমে ব্যবসায়ী LFP প্রদানকারীর কাছে পরিচিত।

এই কোড নমুনা দেখায় কিভাবে একটি LFP প্রদানকারীর সাথে লিঙ্ক করতে হয়:

package shopping.merchant.samples.accounts.v1;

// [START merchantapi_link_lfp_provider]
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.LfpProvidersServiceClient;
import com.google.shopping.merchant.accounts.v1.LfpProvidersServiceSettings;
import com.google.shopping.merchant.accounts.v1.LinkLfpProviderRequest;
import shopping.merchant.samples.utils.Authenticator;

/** This class demonstrates how to link the Lfp Providers for a given Merchant Center account */
public class LinkLfpProviderSample {

  public static void linkLfpProvider(String lfpProviderName, String externalAccountId)
      throws Exception {

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

    // Creates service settings using the retrieved credentials.
    LfpProvidersServiceSettings lfpProvidersServiceSettings =
        LfpProvidersServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    // Calls the API and catches and prints any network failures/errors.
    try (LfpProvidersServiceClient lfpProvidersServiceClient =
        LfpProvidersServiceClient.create(lfpProvidersServiceSettings)) {
      LinkLfpProviderRequest request =
          LinkLfpProviderRequest.newBuilder()
              .setName(lfpProviderName)
              .setExternalAccountId(externalAccountId)
              .build();

      System.out.println("Sending link lfp provider request:");
      // Empty response returned on success.
      lfpProvidersServiceClient.linkLfpProvider(request);
      System.out.println(String.format("Successfully linked to LFP provider: %s", lfpProviderName));
    } catch (Exception e) {
      System.out.println("An error has occurred: ");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    // The name of the lfp provider you want to link, returned from `lfpProviders.findLfpProviders`.
    // It's of the form
    // "accounts/{account_id}/omnichannelSettings/{omnichannel_settings}/lfpProviders/{lfp_provider}".
    String lfpProviderName = "{LFP_PROVIDER_NAME}";
    // External account ID by which this merchant is known to the LFP provider.
    String externalAccountId = "{EXTERNAL_ACCOUNT_ID}";

    linkLfpProvider(lfpProviderName, externalAccountId);
  }
}
// [END merchantapi_link_lfp_provider]

``` You can check your LFP status by calling `omnichannelSettings.get` and
checking the `LfpLink` field.

To learn more about how to use LFP, see [Local feeds partnership
API](https://developers.google.com/merchant/api/guides/local-feeds-partnership/overview).