Merchant API を使用して販売者を確認する

販売者レビューによって、ユーザーは質の高いカスタマー エクスペリエンスを提供しているビジネスを見つけ、そのビジネスへの信頼を高め、十分な情報に基づいて購入を判断できます。その結果、販売者は広告とオーガニック リスティングのパフォーマンスを高め、より多くの有望な見込み顧客をランディング ページに誘導できるようになります。

このページでは、Merchant API を使用して販売者レビューを管理する方法について説明します。

前提条件

Google に特定の情報を提供していただく必要があります。以下をご用意ください。

  • Google Merchant Center で有効な販売者レビュー データソース。
  • アカウントがストアの評価プログラムに登録されている必要があります。すでに登録済みかどうか不明な場合は、Merchant Center でご確認ください。登録していない場合は、リクエスト フォームを送信してください。

データソースを作成する

販売者レビュー フィードを作成するには、accounts.dataSources.create メソッドを使用します。既存の販売者レビュー フィードが利用可能な場合は、accounts.dataSources.get を使用して dataSource.name フィールドを取得します。

リクエストの形式は次のとおりです。

POST https://merchantapi.googleapis.com/datasources/v1/accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}

この例は、一般的なリクエストとレスポンスを示しています。

リクエスト

POST https://merchantapi.googleapis.com/datasources/v1/accounts/123/dataSources {"displayName": "test api feed", "merchantReviewDataSource":{} }

レスポンス

{
  "name": "accounts/123/dataSources/1000000573361824",
  "dataSourceId": "1000000573361824",
  "displayName": "test api feed",
  "merchantReviewDataSource": {},
  "input": "API"
}

詳しくは、商品レビューのデータソースを作成するをご覧ください。

販売者のクチコミを作成する

accounts.merchantReviews.insert メソッドを使用して、販売者レビューを作成または更新できます。accounts.merchantReviews.insert メソッドは、merchantreview リソースとデータソース名を入力として受け取ります。成功した場合は、新規または更新された販売者レビューを返します。販売者レビューを作成するには、datasource.name が必要です。

リクエストの形式:

POST https://merchantapi.googleapis.com/reviews/v1alpha/{parent=accounts/*/}merchantReviews:insert

参考として、次の販売者レビューのサンプルをご覧ください。

POST https://merchantapi.googleapis.com/reviews/v1alpha/accounts/{ACCOUNT_ID}/merchantReviews:insert?dataSource=accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}

  merchantReviewId = 'my_own_review'
  merchantReviewAttributes {
    merchantId = 'merchant_id'
    merchantDisplayName = 'merchant_display_name'
    merchantLink = 'publisher_name'
    merchantRatingLink = 'https://www.google.com'
    minRating = 1
    maxRating = 10
    rating = 7.9
    title = 'Amazing Merchant'
    content = 'This is an incredible merchant'
    reviewerId = 'reviewer_id'
    reviewerUsername = 'reviewer_username'
    isAnonymous = false
    collectionMethod = 'AFTER_FULFILLMENT'
    reviewTime = '2024-04-01T00:00:00Z'
    reviewLanguage = 'en'
    reviewCountry = 'US'
  }

販売者レビューの作成後、レビューが反映されるまでに数分かかることがあります。

販売者レビューを表示する

販売者のレビューを表示するには、accounts.merchantReviews.get を使用します。これは読み取り専用です。名前フィールドの一部として merchantId と販売者レビューの ID が必要です。get メソッドは、対応する販売者レビュー リソースを返します。

次に例を示します。

GET https://merchantapi.googleapis.com/reviews/v1alpha/{name=accounts/*/merchantReviews/*}

特定の Merchant Center アカウントの単一の商品を取得するには、次の例に示すように google.shopping.merchant.accounts.v1.GetProductRequest メソッドを使用します。

Java

import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.products.v1.GetProductRequest;
import com.google.shopping.merchant.products.v1.Product;
import com.google.shopping.merchant.products.v1.ProductsServiceClient;
import com.google.shopping.merchant.products.v1.ProductsServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/** This class demonstrates how to get a single product for a given Merchant Center account */
public class GetProductSample {

  public static void getProduct(Config config, String product) throws Exception {

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

    // Creates service settings using the credentials retrieved above.
    ProductsServiceSettings productsServiceSettings =
        ProductsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    // Calls the API and catches and prints any network failures/errors.
    try (ProductsServiceClient productsServiceClient =
        ProductsServiceClient.create(productsServiceSettings)) {

      // The name has the format: accounts/{account}/products/{productId}
      GetProductRequest request = GetProductRequest.newBuilder().setName(product).build();

      System.out.println("Sending get product request:");
      Product response = productsServiceClient.getProduct(request);

      System.out.println("Retrieved Product below");
      System.out.println(response);
    } catch (Exception e) {
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();
    // The name of the `product`, returned after a `Product.insert` request. We recommend
    // having stored this value in your database to use for all future requests.
    String product = "accounts/{datasource}/products/{productId}";

    getProduct(config, product);
  }
}

販売者レビューを一覧表示する

accounts.merchantReviews.list メソッドを使用すると、作成されたすべての販売者レビューを表示できます。

GET https://merchantapi.googleapis.com/reviews/v1alpha/accounts/{ACCOUNT_ID}/merchantReviews

販売者レビューを削除する

販売者のクチコミを削除するには、accounts.merchantReviews.delete を使用します。accounts.merchantReviews.get メソッドと同様に、このメソッドでは作成時に返された販売者レビューの名前フィールドが必要です。

次に例を示します。

DELETE https://merchantapi.googleapis.com/reviews/v1alpha/{name=accounts/*/merchantReviews/*}

販売者レビューのステータス

販売者レビュー リソースには、他の API と同様のステータスが含まれています。これはリソースの不可欠な部分であり、同じ問題と宛先の構造に従います。