আপনার অনলাইন স্টোরের URL হল আপনার বণিক কেন্দ্রের হোমপেজ। আপনি প্রথমে আপনার হোমপেজ URL সেট বা আপডেট করুন। তারপর, বিভিন্ন Merchant Center বৈশিষ্ট্য আনলক করতে এবং Google সারফেসে বিজ্ঞাপন সক্ষম করতে, আপনাকে যাচাই করতে হবে যে এই URL-এর সাথে যুক্ত ওয়েবসাইটের উপর আপনার নিয়ন্ত্রণ আছে। আপনার ওয়েবসাইট যাচাই করার পরে, আপনি মার্চেন্ট সেন্টারে হোমপেজ দাবি করতে পারেন।
আপনি নিম্নলিখিত ক্রিয়াকলাপগুলি সহ মার্চেন্ট API ব্যবহার করে আপনার হোমপেজ সেটিংস পরিচালনা করতে পারেন:
- আপনার হোমপেজ URL সেট করুন
- আপনার হোমপেজ URL দাবি করুন
- আপনার হোমপেজ URL দাবিত্যাগ
পূর্বশর্ত
আপনি আপনার দোকানের ওয়েবসাইট দাবি করার আগে, আপনাকে এটি যাচাই করতে হবে। ওয়েবসাইট যাচাইকরণের গুরুত্ব সম্পর্কে আরও তথ্যের জন্য, দেখুন অনলাইন স্টোর URL যাচাইকরণ বোঝা । প্রক্রিয়াটি বুঝতে, সাইট যাচাইকরণ API দেখুন।
বিশেষ বিবেচনা
আপনার হোমপেজের URL আপডেট করতে, API ব্যবহার করে আপনার হোমপেজ দাবি করতে বা দাবিত্যাগ করতে, আপনার Merchant Center অ্যাকাউন্টে অ্যাডমিন অ্যাক্সেস প্রয়োজন।
আপনার বর্তমান হোমপেজ সেটিংস পান
আপনার দোকানের কনফিগার করা হোমপেজ URL পুনরুদ্ধার করতে এবং এটি সফলভাবে দাবি করা হয়েছে কিনা তা দেখতে, accounts.homepage.getHomepage
পদ্ধতিটি ব্যবহার করুন৷
এখানে একটি উদাহরণ HTTPS অনুরোধ:
GET https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/homepage
একটি সফল অনুরোধ বর্তমান ইউআরআই এবং দাবির স্থিতি সহ Homepage
সংস্থান ফেরত দেয়।
এখানে একটি উদাহরণ প্রতিক্রিয়া:
{
"name": "accounts/{ACCOUNT_ID}/homepage",
"uri": "https://www.example.com",
"claimed": true
}
যদি কোনো হোমপেজ সেট করা না থাকে, তাহলে এটি claimed
একটি মান ফেরত দেয় না।
{
"name": "accounts/{ACCOUNT_ID}/homepage",
"uri": "",
}
জাভা
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.GetHomepageRequest;
import com.google.shopping.merchant.accounts.v1.Homepage;
import com.google.shopping.merchant.accounts.v1.HomepageName;
import com.google.shopping.merchant.accounts.v1.HomepageServiceClient;
import com.google.shopping.merchant.accounts.v1.HomepageServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to get the homepage for a given Merchant Center account */
public class GetHomepageSample {
public static void getHomepage(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.
HomepageServiceSettings homepageServiceSettings =
HomepageServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
// Creates Homepage name to identify Homepage.
String name =
HomepageName.newBuilder().setAccount(config.getAccountId().toString()).build().toString();
// Calls the API and catches and prints any network failures/errors.
try (HomepageServiceClient homepageServiceClient =
HomepageServiceClient.create(homepageServiceSettings)) {
// The name has the format: accounts/{account}/homepage
GetHomepageRequest request = GetHomepageRequest.newBuilder().setName(name).build();
System.out.println("Sending Get Homepage request:");
Homepage response = homepageServiceClient.getHomepage(request);
System.out.println("Retrieved Homepage below");
System.out.println(response);
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
getHomepage(config);
}
}
পিএইচপি
use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\GetHomepageRequest;
use Google\Shopping\Merchant\Accounts\V1\Client\HomepageServiceClient;
/**
* This class demonstrates how to get the homepage for a given Merchant Center account
*/
class GetHomepage
{
/**
* Gets the homepage for a given Merchant Center account.
*
* @param array $config The configuration data for authentication and account ID.
* @return void
* @throws ApiException if the API call fails.
*/
public static function getHomepageSample(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.
$homepageServiceClient = new HomepageServiceClient($options);
// Creates Homepage name to identify Homepage.
// The name has the format: accounts/{account}/homepage
$name = "accounts/" . $config['accountId'] . "/homepage";
// Calls the API and catches and prints any network failures/errors.
try {
$request = new GetHomepageRequest(['name' => $name]);
print "Sending Get Homepage request:\n";
$response = $homepageServiceClient->getHomepage($request);
print "Retrieved Homepage below\n";
print_r($response);
} catch (ApiException $e) {
print $e->getMessage();
}
}
/**
* Helper to execute the sample.
*
* @return void
*/
public function callSample(): void
{
$config = Config::generateConfig();
// Makes the call to get the homepage.
self::getHomepageSample($config);
}
}
// Run the script
$sample = new GetHomepage();
$sample->callSample();
পাইথন
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import GetHomepageRequest
from google.shopping.merchant_accounts_v1 import HomepageServiceClient
_ACCOUNT = configuration.Configuration().read_merchant_info()
def get_homepage():
"""Gets the homepage for a given Merchant Center account."""
# Gets OAuth Credentials.
credentials = generate_user_credentials.main()
# Creates a client.
client = HomepageServiceClient(credentials=credentials)
# Creates Homepage name to identify Homepage.
name = "accounts/" + _ACCOUNT + "/homepage"
# Creates the request.
request = GetHomepageRequest(name=name)
# Makes the request and catches and prints any error messages.
try:
response = client.get_homepage(request=request)
print("Retrieved Homepage below")
print(response)
except RuntimeError as e:
print(e)
if __name__ == "__main__":
get_homepage()
cURL
curl --location --request GET \
'https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/homepage' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>'
আপনার হোমপেজ URL আপডেট করুন
আপনার Merchant Center অ্যাকাউন্টের সাথে যুক্ত ওয়েবসাইট URL সেট বা পরিবর্তন করতে, updateHomepage
পদ্ধতি ব্যবহার করুন।
আপনাকে অনুরোধের বডিতে Homepage
রিসোর্স প্রদান করতে হবে, নতুন uri
নির্দিষ্ট করে, এবং update_mask
এ uri
অন্তর্ভুক্ত করতে হবে।
এখানে একটি উদাহরণ HTTPS অনুরোধ:
PATCH https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/homepage?update_mask=uri
এখানে একটি উদাহরণ অনুরোধ পেলোড:
{
"name": "accounts/{ACCOUNT_ID}/homepage",
"uri": "https://www.new-example.com"
}
একটি সফল অনুরোধ আপডেট করা Homepage
রিসোর্স ফেরত দেয়।
এখানে একটি উদাহরণ প্রতিক্রিয়া:
{
"name": "accounts/{ACCOUNT_ID}/homepage",
"uri": "https://www.new-example.com",
"claimed": true
}
জাভা
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.protobuf.FieldMask;
import com.google.shopping.merchant.accounts.v1.Homepage;
import com.google.shopping.merchant.accounts.v1.HomepageName;
import com.google.shopping.merchant.accounts.v1.HomepageServiceClient;
import com.google.shopping.merchant.accounts.v1.HomepageServiceSettings;
import com.google.shopping.merchant.accounts.v1.UpdateHomepageRequest;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to update a homepage to a new URL. */
public class UpdateHomepageSample {
public static void updateHomepage(Config config, String uri) throws Exception {
GoogleCredentials credential = new Authenticator().authenticate();
HomepageServiceSettings homepageServiceSettings =
HomepageServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
// Creates homepage name to identify homepage.
String name =
HomepageName.newBuilder().setAccount(config.getAccountId().toString()).build().toString();
// Create a homepage with the updated fields.
Homepage homepage = Homepage.newBuilder().setName(name).setUri(uri).build();
FieldMask fieldMask = FieldMask.newBuilder().addPaths("uri").build();
try (HomepageServiceClient homepageServiceClient =
HomepageServiceClient.create(homepageServiceSettings)) {
UpdateHomepageRequest request =
UpdateHomepageRequest.newBuilder().setHomepage(homepage).setUpdateMask(fieldMask).build();
System.out.println("Sending Update Homepage request");
Homepage response = homepageServiceClient.updateHomepage(request);
System.out.println("Updated Homepage Name below");
System.out.println(response.getName());
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
// The URI (a URL) of the store's homepage.
String uri = "https://example.com";
updateHomepage(config, uri);
}
}
পিএইচপি
use Google\ApiCore\ApiException;
use Google\Protobuf\FieldMask;
use Google\Shopping\Merchant\Accounts\V1\Homepage;
use Google\Shopping\Merchant\Accounts\V1\Client\HomepageServiceClient;
use Google\Shopping\Merchant\Accounts\V1\UpdateHomepageRequest;
/**
* This class demonstrates how to update a homepage to a new URL.
*/
class UpdateHomepage
{
/**
* Updates a homepage to a new URL.
*
* @param array $config The configuration data for authentication and account ID.
* @param string $uri The new URI for the homepage.
* @return void
* @throws ApiException if the API call fails.
*/
public static function updateHomepageSample(array $config, string $uri): 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.
$homepageServiceClient = new HomepageServiceClient($options);
// Creates Homepage name to identify Homepage.
// The name has the format: accounts/{account}/homepage
$name = "accounts/" . $config['accountId'] . "/homepage";
// Create a homepage with the updated fields.
$homepage = new Homepage(['name' => $name, 'uri' => $uri]);
// Create field mask to specify which fields to update.
$fieldMask = new FieldMask(['paths' => ['uri']]);
try {
$request = new UpdateHomepageRequest([
'homepage' => $homepage,
'update_mask' => $fieldMask
]);
print "Sending Update Homepage request\n";
$response = $homepageServiceClient->updateHomepage($request);
print "Updated Homepage Name below\n";
print $response->getName() . "\n";
} catch (ApiException $e) {
print $e->getMessage();
}
}
/**
* Helper to execute the sample.
*
* @return void
*/
public function callSample(): void
{
$config = Config::generateConfig();
// The URI (a URL) of the store's homepage.
$uri = "https://example.com";
// Makes the call to update the homepage.
self::updateHomepageSample($config, $uri);
}
}
// Run the script
$sample = new UpdateHomepage();
$sample->callSample();
পাইথন
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.protobuf import field_mask_pb2
from google.shopping.merchant_accounts_v1 import Homepage
from google.shopping.merchant_accounts_v1 import HomepageServiceClient
from google.shopping.merchant_accounts_v1 import UpdateHomepageRequest
_ACCOUNT = configuration.Configuration().read_merchant_info()
def update_homepage(new_uri):
"""Updates a homepage to a new URL."""
# Gets OAuth Credentials.
credentials = generate_user_credentials.main()
# Creates a client.
client = HomepageServiceClient(credentials=credentials)
# Creates Homepage name to identify Homepage.
name = "accounts/" + _ACCOUNT + "/homepage"
# Create a homepage with the updated fields.
homepage = Homepage(name=name, uri=new_uri)
# Create a FieldMask for the "uri" field.
field_mask = field_mask_pb2.FieldMask(paths=["uri"])
# Creates the request.
request = UpdateHomepageRequest(homepage=homepage, update_mask=field_mask)
# Makes the request and catches and prints any error messages.
try:
response = client.update_homepage(request=request)
print("Updated Homepage Name below")
print(response.name)
except RuntimeError as e:
print(e)
if __name__ == "__main__":
# The URI (a URL) of the store's homepage.
uri = "https://example.com"
update_homepage(uri)
cURL
curl --location --request PATCH \
'https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/homepage?update_mask=uri' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"name": "accounts/{ACCOUNT_ID}/homepage",
"uri": "https://www.new-example.com"
}'
আপনার হোমপেজ দাবি করুন
আপনার অনলাইন স্টোরের হোমপেজ দাবি করতে, claim
পদ্ধতি ব্যবহার করুন। কিন্তু আপনি আপনার হোমপেজ দাবি করার আগে, আপনাকে অবশ্যই যাচাইকরণ সম্পূর্ণ করতে হবে, এটি এমন একটি প্রক্রিয়া যা প্রমাণ করে যে আপনি ওয়েবসাইটের মালিক।
এখানে একটি উদাহরণ HTTPS অনুরোধ:
POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/homepage:claim
আপনি যদি অন্য অ্যাকাউন্ট থেকে একটি বিদ্যমান দাবি ওভাররাইট করতে চান তবে এখানে একটি উদাহরণ অনুরোধ পেলোড রয়েছে:
{
"overwrite": true
}
একটি সফল অনুরোধ Homepage
রিসোর্স ফেরত দেয়। দাবি সফল হলে, claimed
ক্ষেত্রটি true
হবে।
এখানে একটি উদাহরণ প্রতিক্রিয়া:
{
"name": "accounts/{ACCOUNT_ID}/homepage",
"uri": "https://www.new-example.com",
"claimed": true
}
জাভা
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.ClaimHomepageRequest;
import com.google.shopping.merchant.accounts.v1.Homepage;
import com.google.shopping.merchant.accounts.v1.HomepageName;
import com.google.shopping.merchant.accounts.v1.HomepageServiceClient;
import com.google.shopping.merchant.accounts.v1.HomepageServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to claim the homepage for a given Merchant Center account. */
public class ClaimHomepageSample {
// Executing this method requires admin access.
public static void claimHomepage(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.
HomepageServiceSettings homepageServiceSettings =
HomepageServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
// Creates Homepage name to identify Homepage.
// The name has the format: accounts/{account}/homepage
String name =
HomepageName.newBuilder().setAccount(config.getAccountId().toString()).build().toString();
// Calls the API and catches and prints any network failures/errors.
try (HomepageServiceClient homepageServiceClient =
HomepageServiceClient.create(homepageServiceSettings)) {
ClaimHomepageRequest request = ClaimHomepageRequest.newBuilder().setName(name).build();
System.out.println("Sending Claim Homepage request:");
// If the homepage is already claimed, this will recheck the
// verification (unless the merchant is exempt from claiming, which also
// exempts from verification) and return a successful response. If ownership
// can no longer be verified, it will return an error, but it won't lose an existing
// claim. In case of failure, a canonical error message will be returned:
// * PERMISSION_DENIED: user doesn't have the necessary permissions on this
// MC account;
// * FAILED_PRECONDITION:
// - The account is not a Merchant Center account;
// - MC account doesn't have a homepage;
// - claiming failed (in this case the error message will contain more
// details).
Homepage response = homepageServiceClient.claimHomepage(request);
System.out.println("Retrieved Homepage below");
System.out.println(response);
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
claimHomepage(config);
}
}
পিএইচপি
use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\ClaimHomepageRequest;
use Google\Shopping\Merchant\Accounts\V1\Client\HomepageServiceClient;
/**
* This class demonstrates how to claim the homepage for a given Merchant Center account.
*/
class ClaimHomepage
{
/**
* Claims the homepage for a given Merchant Center account.
*
* @param array $config The configuration data for authentication and account ID.
* @return void
* @throws ApiException if the API call fails.
*/
public static function claimHomepageSample(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.
$homepageServiceClient = new HomepageServiceClient($options);
// Creates Homepage name to identify Homepage.
// The name has the format: accounts/{account}/homepage
$name = "accounts/" . $config['accountId'] . "/homepage";
// Calls the API and catches and prints any network failures/errors.
try {
$request = new ClaimHomepageRequest(['name' => $name]);
print "Sending Claim Homepage request:\n";
$response = $homepageServiceClient->claimHomepage($request);
print "Retrieved Homepage below\n";
print_r($response);
} catch (ApiException $e) {
print $e->getMessage();
}
}
/**
* Helper to execute the sample.
*
* @return void
*/
public function callSample(): void
{
$config = Config::generateConfig();
// Makes the call to claim the homepage.
self::claimHomepageSample($config);
}
}
// Run the script
$sample = new ClaimHomepage();
$sample->callSample();
পাইথন
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import ClaimHomepageRequest
from google.shopping.merchant_accounts_v1 import HomepageServiceClient
_ACCOUNT = configuration.Configuration().read_merchant_info()
def claim_homepage():
"""Claims the homepage for a given Merchant Center account."""
# Gets OAuth Credentials.
credentials = generate_user_credentials.main()
# Creates a client.
client = HomepageServiceClient(credentials=credentials)
# Creates Homepage name to identify Homepage.
name = "accounts/" + _ACCOUNT + "/homepage"
# Creates the request.
request = ClaimHomepageRequest(name=name)
# Makes the request and catches and prints any error messages.
try:
response = client.claim_homepage(request=request)
print("Retrieved Homepage below")
print(response)
except RuntimeError as e:
print(e)
if __name__ == "__main__":
claim_homepage()
cURL
curl --location --request POST \
'https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/homepage:claim' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"overwrite": true
}'
আপনার হোমপেজ দাবিত্যাগ
আপনার দোকানের হোমপেজ থেকে দাবি করা স্ট্যাটাস অপসারণ করতে, unclaim
পদ্ধতি ব্যবহার করুন। আপনি এটি করতে পারেন যদি আপনি আপনার ওয়েবসাইট পরিবর্তন করে থাকেন বা দাবি করা অবস্থায় আপনার অ্যাকাউন্টের সাথে বর্তমান URL যুক্ত রাখতে চান না।
এখানে একটি উদাহরণ HTTPS অনুরোধ:
POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/homepage:unclaim
এখানে একটি উদাহরণ অনুরোধ পেলোড:
{}
এখানে একটি উদাহরণ প্রতিক্রিয়া:
{
"name": "accounts/{ACCOUNT_ID}/homepage",
"uri": "https://www.new-example.com",
}
জাভা
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.accounts.v1.Homepage;
import com.google.shopping.merchant.accounts.v1.HomepageName;
import com.google.shopping.merchant.accounts.v1.HomepageServiceClient;
import com.google.shopping.merchant.accounts.v1.HomepageServiceSettings;
import com.google.shopping.merchant.accounts.v1.UnclaimHomepageRequest;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to unclaim the homepage for a given Merchant Center account. */
public class UnclaimHomepageSample {
// Executing this method requires admin access.
public static void unclaimHomepage(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.
HomepageServiceSettings homepageServiceSettings =
HomepageServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
// Creates Homepage name to identify Homepage.
// The name has the format: accounts/{account}/homepage
String name =
HomepageName.newBuilder().setAccount(config.getAccountId().toString()).build().toString();
// Calls the API and catches and prints any network failures/errors.
try (HomepageServiceClient homepageServiceClient =
HomepageServiceClient.create(homepageServiceSettings)) {
UnclaimHomepageRequest request = UnclaimHomepageRequest.newBuilder().setName(name).build();
System.out.println("Sending Unclaim Homepage request:");
Homepage response = homepageServiceClient.unclaimHomepage(request);
System.out.println("Retrieved Homepage below");
System.out.println(response);
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
unclaimHomepage(config);
}
}
পিএইচপি
use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Accounts\V1\Client\HomepageServiceClient;
use Google\Shopping\Merchant\Accounts\V1\UnclaimHomepageRequest;
/**
* This class demonstrates how to unclaim the homepage for a given Merchant Center account.
*/
class UnclaimHomepage
{
/**
* Unclaims the homepage for a given Merchant Center account.
*
* @param array $config The configuration data for authentication and account ID.
* @return void
* @throws ApiException if the API call fails.
*/
public static function unclaimHomepageSample(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.
$homepageServiceClient = new HomepageServiceClient($options);
// Creates Homepage name to identify Homepage.
// The name has the format: accounts/{account}/homepage
$name = "accounts/" . $config['accountId'] . "/homepage";
// Calls the API and catches and prints any network failures/errors.
try {
$request = new UnclaimHomepageRequest(['name' => $name]);
print "Sending Unclaim Homepage request:\n";
$response = $homepageServiceClient->unclaimHomepage($request);
print "Retrieved Homepage below\n";
print_r($response);
} catch (ApiException $e) {
print $e->getMessage();
}
}
/**
* Helper to execute the sample.
*
* @return void
*/
public function callSample(): void
{
$config = Config::generateConfig();
// Makes the call to unclaim the homepage.
self::unclaimHomepageSample($config);
}
}
// Run the script
$sample = new UnclaimHomepage();
$sample->callSample();
পাইথন
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_accounts_v1 import HomepageServiceClient
from google.shopping.merchant_accounts_v1 import UnclaimHomepageRequest
_ACCOUNT = configuration.Configuration().read_merchant_info()
def unclaim_homepage():
"""Unclaims the homepage for a given Merchant Center account."""
# Gets OAuth Credentials.
credentials = generate_user_credentials.main()
# Creates a client.
client = HomepageServiceClient(credentials=credentials)
# Creates Homepage name to identify Homepage.
# The name has the format: accounts/{account}/homepage
name = "accounts/" + _ACCOUNT + "/homepage"
# Creates the request.
request = UnclaimHomepageRequest(name=name)
# Makes the request and catches and prints any error messages.
try:
response = client.unclaim_homepage(request=request)
print(f"Unclaimed Homepage: {response}")
except RuntimeError as e:
print(f"Failed to unclaim homepage: {e}")
if __name__ == "__main__":
unclaim_homepage()
cURL
curl --location --request POST \
'https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/homepage:unclaim' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{}'