오프라인 제품 피드 파트너십 (LFP) 제공업체 관리

오프라인 제품 피드 파트너십 프로그램은 소매업체가 자체 기본 피드 및 오프라인 제품 인벤토리 피드를 만들지 않고 오프라인 판매점 인벤토리 광고 및 무료 오프라인 등록정보에 참여할 수 있는 방법입니다. 신뢰할 수 있는 데이터 제공업체가 소매업체를 대신하여 판매 또는 인벤토리 데이터를 Google에 제공할 수 있습니다.

기본 요건

이 섹션의 API 메서드를 사용하려면 먼저 오프라인 판매점 인벤토리 광고 (LIA) 또는 무료 오프라인 등록정보 (FLL) 프로그램을 설정합니다. 자세한 내용은 옴니채널 설정 관리를 참고하세요.

사용 가능한 LFP 제공업체 찾기

특정 국가에서 사용 가능한 모든 LFP 제공업체를 검색하려면 lfpProviders.findLfpProviders를 사용하세요.

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

다음을 바꿉니다.

  • {ACCOUNT_ID}: 판매자 센터 계정의 고유 식별자
  • {REGION_CODE}: Common Locale Data Repository (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}: 판매자 센터 계정의 고유 식별자
  • {LFP_PROVIDER}: 이전 단계에서 반환된 LFP 제공업체 ID입니다. 예를 들어 LFP 제공업체 1의 경우 12345입니다.
  • {EXTERNAL_ACCOUNT_ID}: LFP 제공업체에 판매자가 알려진 외부 계정 ID입니다.

다음 코드 샘플은 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).