Google का कारोबारी ग्रुप, आपके कारोबार की जगहों के लिए शेयर किए गए फ़ोल्डर की तरह होता है. कारोबार की जगहों के ग्रुप की मदद से, अलग-अलग जगहों पर मौजूद कारोबार की जानकारी को मैनेज करने का ऐक्सेस कई उपयोगकर्ताओं के साथ सुरक्षित तरीके से शेयर किया जा सकता है. ज़्यादा जानकारी के लिए, कारोबार की जगहों के ग्रुप के बारे में जानकारी देखें.
स्थानीय इन्वेंट्री अपलोड करने से पहले, कारोबार की जगहों के उस ग्रुप की जानकारी दें जिसके लिए आपका Merchant Center खाता ज़िम्मेदार होगा. Merchant API का इस्तेमाल करके, Business Profile में ज़रूरी शर्तें पूरी करने वाले कारोबारी ग्रुप की सूची देखी जा सकती है. हालांकि, ऐक्सेस पाने के लिए, आपको पहले अपने खाते को Business Profile से लिंक करना होगा.
किसी Business Profile के ऐक्सेस का अनुरोध करना
किसी कारोबार की प्रोफ़ाइल का ऐक्सेस पाने के लिए, gbpAccounts.LinkGbpAccount
इस तरीके का इस्तेमाल करें:
POST https://merchantapi.googleapis.com/accounts/v1/accounts/<var>ACCOUNT_ID</var>/gbpAccounts:linkGbpAccount
{
"gbpEmail": "admin@example.com",
}
इनकी जगह ये डालें:
ACCOUNT_ID
: आपके Merchant Center खाते का यूनीक आइडेंटिफ़ायरGBP_EMAIL
: Business Profile के एडमिन का ईमेल पता
इस तरीके को कॉल करने पर, यह सेवा तय किए गए एडमिन को एक ईमेल भेजती है. इसमें, ऐक्सेस के अनुरोध को स्वीकार या अस्वीकार करने के लिए कहा जाता है. अगर एडमिन सात दिन के अंदर जवाब नहीं देता है, तो अनुरोध की समयसीमा अपने-आप खत्म हो जाएगी.
कारोबार की जगहों के उपलब्ध ग्रुप की सूची
एडमिन के अनुरोध को स्वीकार करने के बाद, gbpAccounts.List
तरीके का इस्तेमाल करके, उपलब्ध कारोबारी ग्रुप देखे जा सकते हैं.
यहां अनुरोध और जवाब का सैंपल दिया गया है:
GET https://merchantapi.googleapis.com/accounts/v1/accounts/<var>ACCOUNT_ID</var>/gbpAccounts
Response:
200 OK
{
"gbpAccounts": [
{
"name": "accounts/<var>ACCOUNT</var>/gbpAccounts/12345",
"gbpAccountId": 12345,
"type": USER,
"gbpAccountName": "admin@example.com",
"listingCount": 15
}, {
"name": "accounts/<var>ACCOUNT</var>/gbpAccounts/67890",
"gbpAccountId": 67890,
"type": BUSINESS_ACCOUNT,
"gbpAccountName": "Google My Business Account",
"listingCount": 23
}
],
"nextPageToken": 50
}
ज़रूरी शर्तें पूरी करने वाले सभी कारोबारी ग्रुप को वापस पाने के लिए, इस कोड सैंपल का इस्तेमाल किया जा सकता है:
package shopping.merchant.samples.accounts.v1;
// [START merchantapi_list_gbp_accounts]
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 retrieved credentials.
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 occurred: ");
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
listGbpAccounts(config);
}
}
// [END merchantapi_list_gbp_accounts]
Merchant Center खाते के लिए, कारोबार की जगहों का ग्रुप तय करना
उपलब्ध कारोबार की जगहों के ग्रुप की सूची में से किसी एक को चुनकर, उस ग्रुप को अपने Merchant Center खाते से जोड़ा जा सकता है. उदाहरण के लिए, अगर आपको पिछले चरण से मिले GBP खाता आईडी 12345
वाले कारोबारी ग्रुप को चुनना है, तो AccountServices.proposeAccountService
का इस्तेमाल करें:
POST
https://merchantapi.googleapis.com/accounts/v1/accounts/<var>ACCOUNT_ID</var>/services:propose
{
provider: "providers/GOOGLE_BUSINESS_PROFILE",
account_service: {
external_account_id: "12345",
local_listing_management {}
}
}
ध्यान दें कि provider
फ़ील्ड में providers/GOOGLE_BUSINESS_PROFILE
होना चाहिए. आपको अनुरोध में, खाली LocalListingManagement
फ़ील्ड सेट करना होगा.
प्रॉडक्ट और इन्वेंट्री डेटा सबमिट करना
Merchant Center खाते को कारोबारी ग्रुप से जोड़ने के बाद, अब आपके पास प्रॉडक्ट और स्थानीय इन्वेंट्री का डेटा अपलोड करने का विकल्प है. ज़्यादा जानकारी के लिए, इसे देखें