Merchant API'yi kullanan satıcıları inceleme

Satıcı yorumları, kullanıcıların yüksek kaliteli müşteri deneyimleri sunan işletmeleri bulmasına yardımcı olarak güven oluşturulmasını ve daha bilinçli satın alma kararları verilmesini sağlar. Sonuç olarak mağaza puanları, işletmelere reklamların ve organik listelemelerin performansını artırmada ve açılış sayfalarına daha nitelikli müşteriler çekmede yardımcı olabilir.

Bu sayfada, Merchant API'yi kullanarak satıcı yorumlarını nasıl yönetebileceğiniz açıklanmaktadır.

Ön koşullar

Google'ın belirli bilgileri sağlamanız gerekir. Aşağıdakilere sahip olmanız gerekir:

  • Google Merchant Center'da etkin bir satıcı yorumları veri kaynağı.
  • Hesabınızın mağaza puanları programına kayıtlı olması gerekir. Kaydolup kaydolmadığınızdan emin değilseniz Merchant Center'ı kontrol edin. Kayıtlı değilseniz istek formunu gönderin.

Veri kaynağı oluşturma

Satıcı yorumları veri kaynağı oluşturmak için accounts.dataSources.create yöntemini kullanın. Mevcut bir satıcı yorumları veri kaynağı varsa accounts.dataSources.name alanını getirmek için accounts.dataSources.list yöntemini kullanın.

Gelecekteki API çağrılarında doğrudan referans vermek için, oluşturduğunuz veri kaynaklarının accounts.dataSources.name değerini satıcı incelemesi için yerel veritabanınızda depolamanızı öneririz. Mevcut veri kaynaklarınız için yerel veritabanınızı adlarıyla bir defaya mahsus doldurun.

İsteğin biçimi aşağıdaki gibidir:

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

Örnek

Örnekte tipik bir istek ve yanıt gösterilmektedir.

İstek

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

Yanıt

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

Daha fazla bilgi için Ürün yorumu veri kaynağı oluşturma başlıklı makaleyi inceleyin.

Satıcı yorumu oluşturma

Satıcı yorumu oluşturmak veya güncellemek için accounts.merchantReviews.insert yöntemini kullanabilirsiniz. accounts.merchantReviews.insert yöntemi, giriş olarak bir merchantreview kaynağı ve veri kaynağı adı alır. İşlem başarılı olursa yeni veya güncellenmiş satıcı yorumunu döndürür. Satıcı yorumu oluşturmak için accounts.dataSources.name gerekir.

Talebin biçimi:

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

Referans olarak aşağıdaki örnek satıcı yorumunu inceleyin.

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'
  }

Satıcı yorumu oluşturulduktan sonra yorumun yayınlanması birkaç dakika sürebilir.

Satıcı yorumlarını görüntüleme

Satıcı yorumlarını görüntülemek için accounts.merchantReviews.get yöntemini kullanın. Bu salt okunurdur. Ad alanının bir parçası olarak merchantId ve satıcı yorumunun kimliği gerekir. Alma yöntemi, ilgili satıcı yorumu kaynağını döndürür.

Örneğin:

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

Belirli bir Merchant Center hesabı için tek bir ürün almak istiyorsanız aşağıdaki örnekte gösterildiği gibi google.shopping.merchant.accounts.v1.GetProductRequest yöntemini kullanabilirsiniz.

Java


import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.common.io.BaseEncoding;
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 java.nio.charset.StandardCharsets;
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 {

  // Base64Url encoder/decoder without padding
  private static final BaseEncoding BASE64URL_NOPADDING = BaseEncoding.base64Url().omitPadding();

  // Encodes a string to base64url without padding
  public static String encodeProductId(String productId) {
    return BASE64URL_NOPADDING.encode(productId.getBytes(StandardCharsets.UTF_8));
  }

  public static Product getProduct(Config config, String accountId, String productId)
      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();

    try (ProductsServiceClient productsServiceClient =
        ProductsServiceClient.create(productsServiceSettings)) {

      // The name has the format: accounts/{account}/products/{productId}
      String name = "accounts/" + accountId + "/products/" + productId;

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

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

      System.out.println("Retrieved Product below");
      System.out.println(response);
      return response;
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();
    String accountId = config.getAccountId().toString();

    // 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 productId = "en~GB~sku123"; // Replace with your actual product ID

    // Uncomment the following line if the product name contains special characters (such as forward
    // slashes) and needs base64url encoding.
    // productId = encodeProductId(productId);

    getProduct(config, accountId, productId);
  }
}

Satıcı yorumlarını listeleme

Oluşturulan tüm satıcı yorumlarını görüntülemek için accounts.merchantReviews.list yöntemini kullanabilirsiniz.

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

Satıcı yorumlarını silme

Satıcı yorumlarını silmek için accounts.merchantReviews.delete yöntemini kullanın. accounts.merchantReviews.get yöntemine benzer şekilde, bu yöntem de oluşturma sırasında döndürülen satıcı yorumunun ad alanını gerektirir.

Örneğin:

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

Satıcı yorumu durumu

Satıcı yorumu kaynağı, diğer API'lere benzer bir durum içerir. Bu durum, kaynağın ayrılmaz bir parçasıdır ve aynı sorun ve hedef yapısını izler.