管理本地 Feed 合作伙伴关系 (LFP) 提供商
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
零售商可以通过本地 Feed 合作伙伴关系计划参与本地商品目录广告和非付费本地商品详情,而无需创建自己的主要 Feed 和本地商品目录 Feed。可信数据提供商可以代表零售商向 Google 提供销售数据或商品目录数据。
前提条件
如需使用本部分中的 API 方法,请先建立本地商品目录广告 (LIA) 或非付费本地商品详情 (FLL) 计划。如需了解详情,请参阅管理全渠道设置。
查找可用的 LFP 提供商
如需检索某个国家/地区中的所有可用 LFP 提供商,请使用 lfpProviders.findLfpProviders
。
POST
https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{REGION_CODE}/lfpProviders:find
替换以下内容:
成功响应的示例:
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 提供商
如需建立 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 提供程序 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).
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-08。
[null,null,["最后更新时间 (UTC):2025-08-08。"],[],[],null,["# Manage Local Feeds Partnership (LFP) providers\n\nThe [Local Feeds\nPartnership](https://support.google.com/merchants/answer/7676652) program is a\nway for retailers to participate in Local Inventory Ads and Free Local Listings\nwithout having to create their own primary and local product inventory feeds.\nTrusted data providers can provide sales or inventory data to Google on behalf\nof retailers.\n\nPrerequisites\n-------------\n\nTo use the API methods in this section, establish your Local Inventory Ads (LIA)\nor Free Local Listing (FLL) programs first. For more details, see [Manage\nomnichannel\nsettings](/merchant/api/guides/accounts/manage-omnichannel-settings).\n\nFind available LFP providers\n----------------------------\n\nTo retrieve all the available LFP providers in a country, use\n`lfpProviders.findLfpProviders`. \n\n POST\n https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{REGION_CODE}/lfpProviders:find\n\nReplace the following:\n\n- `{ACCOUNT_ID}`: The unique identifier of your Merchant Center account\n- `{REGION_CODE}`: A Region code, from the list defined by the [Common Locale\n Data Repository (CLDR)](https://cldr.unicode.org/) project\n\nA sample successful response: \n\n 200 OK\n {\n \"lsfProviders\": [\n {\n \"name\": \"accounts/{ACCOUNT}/omnichannelSettings/{REGION_CODE}/lsfProviders/12345\",\n \"regionCode\": {REGION_CODE},\n \"displayName\": \"LFP Provider 1\"\n }, {\n \"name\": \"accounts/{ACCOUNT}/omnichannelSettings/{REGION_CODE}/lsfProviders/67890\",\n \"regionCode\": {REGION_CODE},\n \"displayName\": \"LFP Provider 6\"\n }\n ],\n \"nextPageToken\": 50\n }\n\nHere is a code sample: \n\n package shopping.merchant.samples.accounts.v1;\n\n // [START merchantapi_find_lfp_providers]\n import com.google.api.gax.core.FixedCredentialsProvider;\n import com.google.auth.oauth2.GoogleCredentials;\n import com.google.shopping.merchant.accounts.v1.FindLfpProvidersRequest;\n import com.google.shopping.merchant.accounts.v1.LfpProvider;\n import com.google.shopping.merchant.accounts.v1.LfpProvidersServiceClient;\n import com.google.shopping.merchant.accounts.v1.LfpProvidersServiceClient.FindLfpProvidersPagedResponse;\n import com.google.shopping.merchant.accounts.v1.LfpProvidersServiceSettings;\n import com.google.shopping.merchant.accounts.v1.OmnichannelSettingName;\n import shopping.merchant.samples.utils.Authenticator;\n import shopping.merchant.samples.utils.Config;\n\n /** This class demonstrates how to get the Lfp Providers for a given Merchant Center account */\n public class FindLfpProvidersSample {\n\n public static void findLfpProviders(Config config, String regionCode)\n throws Exception {\n\n // Obtains OAuth token based on the user's configuration.\n GoogleCredentials credential = new Authenticator().authenticate();\n\n // Creates service settings using the retrieved credentials.\n LfpProvidersServiceSettings lfpProvidersServiceSettings =\n LfpProvidersServiceSettings.newBuilder()\n .setCredentialsProvider(FixedCredentialsProvider.create(credential))\n .build();\n\n // Gets the account ID from the config file.\n String accountId = config.getAccountId().toString();\n // Creates parent to identify the omnichannelSetting from which to list all Lfp Providers.\n String parent =\n OmnichannelSettingName.newBuilder()\n .setAccount(accountId)\n .setOmnichannelSetting(regionCode)\n .build()\n .toString();\n\n // Calls the API and catches and prints any network failures/errors.\n try (LfpProvidersServiceClient lfpProvidersServiceClient =\n LfpProvidersServiceClient.create(lfpProvidersServiceSettings)) {\n FindLfpProvidersRequest request =\n FindLfpProvidersRequest.newBuilder().setParent(parent).build();\n\n System.out.println(\"Sending find LFP providers request:\");\n FindLfpProvidersPagedResponse response = lfpProvidersServiceClient.findLfpProviders(request);\n\n int count = 0;\n\n // Iterates over all the entries in the response.\n for (LfpProvider lfpProvider : response.iterateAll()) {\n System.out.println(lfpProvider);\n count++;\n }\n System.out.println(String.format(\"The following count of elements were returned: %d\", count));\n } catch (Exception e) {\n System.out.println(\"An error has occurred: \");\n System.out.println(e);\n }\n }\n\n public static void main(String[] args) throws Exception {\n Config config = Config.load();\n\n // The country you're targeting at.\n String regionCode = \"{REGION_CODE}\";\n\n findLfpProviders(config, regionCode);\n }\n }\n // [END merchantapi_find_lfp_providers]\n\nLink an LFP provider\n--------------------\n\nTo build an LFP partnership, use `lfpProviders.LinkLfpProvider`: \n\n POST\n https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/omnichannelSettings/{REGION_CODE}/lfpProviders/{LFP_PROVIDER}:linkLfpProvider\n {\n \"externalAccountId\": \"{EXTERNAL_ACCOUNT_ID}\",\n }\n\nReplace the following:\n\n- `{ACCOUNT_ID}`: The unique identifier of your Merchant Center account\n- `{LFP_PROVIDER}`: The LFP provider ID returned in the previous step. For example, it would be `12345` for LFP Provider 1.\n- `{EXTERNAL_ACCOUNT_ID}`: The external account ID by which the merchant is known to the LFP provider.\n\nThis code sample shows how to link to an LFP provider: \n\n package shopping.merchant.samples.accounts.v1;\n\n // [START merchantapi_link_lfp_provider]\n import com.google.api.gax.core.FixedCredentialsProvider;\n import com.google.auth.oauth2.GoogleCredentials;\n import com.google.shopping.merchant.accounts.v1.LfpProvidersServiceClient;\n import com.google.shopping.merchant.accounts.v1.LfpProvidersServiceSettings;\n import com.google.shopping.merchant.accounts.v1.LinkLfpProviderRequest;\n import shopping.merchant.samples.utils.Authenticator;\n\n /** This class demonstrates how to link the Lfp Providers for a given Merchant Center account */\n public class LinkLfpProviderSample {\n\n public static void linkLfpProvider(String lfpProviderName, String externalAccountId)\n throws Exception {\n\n // Obtains OAuth token based on the user's configuration.\n GoogleCredentials credential = new Authenticator().authenticate();\n\n // Creates service settings using the retrieved credentials.\n LfpProvidersServiceSettings lfpProvidersServiceSettings =\n LfpProvidersServiceSettings.newBuilder()\n .setCredentialsProvider(FixedCredentialsProvider.create(credential))\n .build();\n\n // Calls the API and catches and prints any network failures/errors.\n try (LfpProvidersServiceClient lfpProvidersServiceClient =\n LfpProvidersServiceClient.create(lfpProvidersServiceSettings)) {\n LinkLfpProviderRequest request =\n LinkLfpProviderRequest.newBuilder()\n .setName(lfpProviderName)\n .setExternalAccountId(externalAccountId)\n .build();\n\n System.out.println(\"Sending link lfp provider request:\");\n // Empty response returned on success.\n lfpProvidersServiceClient.linkLfpProvider(request);\n System.out.println(String.format(\"Successfully linked to LFP provider: %s\", lfpProviderName));\n } catch (Exception e) {\n System.out.println(\"An error has occurred: \");\n System.out.println(e);\n }\n }\n\n public static void main(String[] args) throws Exception {\n // The name of the lfp provider you want to link, returned from `lfpProviders.findLfpProviders`.\n // It's of the form\n // \"accounts/{account_id}/omnichannelSettings/{omnichannel_settings}/lfpProviders/{lfp_provider}\".\n String lfpProviderName = \"{LFP_PROVIDER_NAME}\";\n // External account ID by which this merchant is known to the LFP provider.\n String externalAccountId = \"{EXTERNAL_ACCOUNT_ID}\";\n\n linkLfpProvider(lfpProviderName, externalAccountId);\n }\n }\n // [END merchantapi_link_lfp_provider]\n\n ``` You can check your LFP status by calling `omnichannelSettings.get` and\n checking the `LfpLink` field.\n\n To learn more about how to use LFP, see [Local feeds partnership\n API](https://developers.google.com/merchant/api/guides/local-feeds-partnership/overview)."]]