लोगों के लिए, प्रॉडक्ट की समीक्षाएं शॉपिंग के अनुभव का एक अहम हिस्सा होती हैं. ये रेटिंग और समीक्षाएं, लोगों को प्रॉडक्ट के बारे में रिसर्च करने और खरीदारी से जुड़े फ़ैसले लेने में मदद करती हैं. प्रॉडक्ट की अच्छी समीक्षाओं से, सेलर के प्रॉडक्ट पेजों पर ज़्यादा संख्या में सही खरीदारों को लाने में मदद मिल सकती है. इन सोर्स में सेलर, समीक्षा एग्रीगेटर, समीक्षा करने वाली साइटें, और Google का इस्तेमाल करने वाले लोग शामिल हैं.
इस पेज पर, Merchant API का इस्तेमाल करके प्रॉडक्ट की समीक्षाएं मैनेज करने का तरीका बताया गया है.
ज़रूरी शर्तें
Google को आपसे कुछ खास जानकारी चाहिए. आपके पास ये चीज़ें होनी चाहिए:
- Google Merchant Center में, प्रॉडक्ट की समीक्षाओं का कोई चालू फ़ीड.
- आपका खाता, प्रॉडक्ट रेटिंग प्रोग्राम में शामिल होना चाहिए. प्रोग्राम सब-एपीआई का इस्तेमाल करके, प्रोग्राम के लिए ज़रूरी शर्तें पूरी होने की स्थिति को प्रोग्राम के हिसाब से देखा जा सकता है. इसके अलावा, Merchant Center के ज़रिए भी यह देखा जा सकता है.अगर आपका खाता, प्रोग्राम के लिए ज़रूरी शर्तें पूरी नहीं करता है, तो प्रॉडक्ट रेटिंग प्रोग्राम में शामिल होने के बारे में ज़्यादा जानें .
- Merchant API का इस्तेमाल करके प्रॉडक्ट की समीक्षा करने के लिए, हमारे अनुरोध फ़ॉर्म का इस्तेमाल करके अनुरोध सबमिट करें.
डेटा सोर्स बनाएं
प्रॉडक्ट की समीक्षाओं का फ़ीड बनाने के लिए, datasource.create तरीके का इस्तेमाल करें. अगर प्रॉडक्ट की समीक्षाओं का कोई मौजूदा फ़ीड उपलब्ध है, तो accounts.dataSources.name फ़ेच करने के लिए, accounts.dataSources.get का इस्तेमाल करें. अनुरोध का फ़ॉर्मैट इस तरह होता है:
POST https://merchantapi.googleapis.com/datasources/v1beta/accounts/{account}/dataSources/{datasource}
उदाहरण
इस उदाहरण में, सामान्य अनुरोध और जवाब दिखाया गया है.
अनुरोध
POST https://merchantapi.googleapis.com/datasources/v1beta/accounts/123/dataSources {"displayName": "test api feed", "productReviewDataSource":{} }
जवाब
{
"name": "accounts/123/dataSources/1000000573361824",
"dataSourceId": "1000000573361824",
"displayName": "test api feed",
"productReviewDataSource": {},
"input": "API"
}
ज़्यादा जानकारी के लिए, प्रॉडक्ट की समीक्षाओं का डेटा सोर्स बनाना लेख पढ़ें.
प्रॉडक्ट की समीक्षा बनाना
प्रॉडक्ट की समीक्षा बनाने या अपडेट करने के लिए, accounts.productreviews.insert तरीके का इस्तेमाल किया जा सकता है. accounts.productreviews.insert तरीके के लिए,
productreview संसाधन और डेटा सोर्स का नाम इनपुट के तौर पर ज़रूरी होता है. अगर यह तरीका काम करता है, तो यह नया या अपडेट किया गया productreview दिखाता है. प्रॉडक्ट की समीक्षा बनाने के लिए, आपके पास
होना चाहिए
datasource.name.
अनुरोध का फ़ॉर्मैट:
POST https://merchantapi.googleapis.com/reviews/v1alpha/{parent=accounts/{ACCOUNT_ID}/}productReviews:insert
यहां दिए गए अनुरोध के नमूने से, प्रॉडक्ट की समीक्षा बनाने का तरीका पता चलता है.
POST https://merchantapi.googleapis.com/reviews/v1alpha/accounts/{ACCOUNT_ID}/productReviews:insert?dataSource=accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}
productReviewId = 'my_product_review'
productReviewAttributes {
aggregatorName = 'aggregator_name'
subclientName = 'subclient_name'
publisherName = 'publisher_name'
publisherFavicon = 'https://www.google.com/favicon.ico'
reviewerId = 'reviewer_id'
reviewerIsAnonymous = false
reviewerUsername = 'reviewer_username'
reviewLanguage = 'en'
reviewCountry = 'US'
reviewTime = '2024-04-01T00:00:00Z'
title = 'Incredible product'
content = 'This is an incredible product.'
pros = ['pro1', 'pro2']
cons = ['con1', 'con2']
reviewLink = {
type = 'SINGLETON'
link = 'https://www.google.com'
}
reviewerImageLink = 'https://www.google.com/reviewer.png'
minRating = 1
maxRating = 10
rating = 8.5
productName = 'product_name'
productLink = 'https://www.google.com/product'
asins = ['asin1', 'asin2']
gtins = ['gtin1', 'gtin2']
mpns = ['mpn1', 'mpn2']
skus = ['sku1', 'sku2']
brands = ['brand1', 'brand2']
isSpam = false
collectionMethod = 'POST_FULFILLMENT'
transactionId = 'transaction_id'
}
प्रॉडक्ट की समीक्षा बनाने के बाद, उसे दिखने में कुछ मिनट लग सकते हैं.
यहां एक नमूना दिया गया है. इसका इस्तेमाल करके, प्रॉडक्ट की कई समीक्षाएं एसिंक्रोनस तरीके से जोड़ी जा सकती हैं:
Java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.reviews.v1beta.ListProductReviewsRequest;
import com.google.shopping.merchant.reviews.v1beta.ProductReview;
import com.google.shopping.merchant.reviews.v1beta.ProductReviewsServiceClient;
import com.google.shopping.merchant.reviews.v1beta.ProductReviewsServiceClient.ListProductReviewsPagedResponse;
import com.google.shopping.merchant.reviews.v1beta.ProductReviewsServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to list all the product reviews in a given account. */
public class ListProductReviewsSample {
public static void listProductReviews(String accountId) throws Exception {
GoogleCredentials credential = new Authenticator().authenticate();
ProductReviewsServiceSettings productReviewsServiceSettings =
ProductReviewsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
try (ProductReviewsServiceClient productReviewsServiceClient =
ProductReviewsServiceClient.create(productReviewsServiceSettings)) {
ListProductReviewsRequest request =
ListProductReviewsRequest.newBuilder()
.setParent(String.format("accounts/%s", accountId))
.build();
System.out.println("Sending list product reviews request:");
ListProductReviewsPagedResponse response =
productReviewsServiceClient.listProductReviews(request);
int count = 0;
// Iterates over all rows in all pages and prints all product reviews.
for (ProductReview element : response.iterateAll()) {
System.out.println(element);
count++;
}
System.out.print("The following count of elements were returned: ");
System.out.println(count);
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
listProductReviews(config.getAccountId().toString());
}
}
प्रॉडक्ट की समीक्षा पाना
प्रॉडक्ट की समीक्षा देखने के लिए, accounts.productreviews.get का इस्तेमाल करें. यह सिर्फ़ पढ़ने के लिए है.
इसके लिए, नाम वाले फ़ील्ड में आपके accountId और प्रॉडक्ट की समीक्षा का आईडी ज़रूरी है. GET तरीका, प्रॉडक्ट की समीक्षा का संसाधन दिखाता है.
GET https://merchantapi.googleapis.com/reviews/v1/{name=accounts/{ACCOUNT_ID}/productReviews/*}
यहां एक नमूना दिया गया है. इसका इस्तेमाल करके, प्रॉडक्ट की समीक्षा पाई जा सकती है:
Java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.reviews.v1beta.GetProductReviewRequest;
import com.google.shopping.merchant.reviews.v1beta.ProductReview;
import com.google.shopping.merchant.reviews.v1beta.ProductReviewsServiceClient;
import com.google.shopping.merchant.reviews.v1beta.ProductReviewsServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to get a product review. */
public class GetProductReviewSample {
public static void getProductReview(String accountId, String productReviewId) throws Exception {
GoogleCredentials credential = new Authenticator().authenticate();
ProductReviewsServiceSettings productReviewsServiceSettings =
ProductReviewsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
try (ProductReviewsServiceClient productReviewsServiceClient =
ProductReviewsServiceClient.create(productReviewsServiceSettings)) {
GetProductReviewRequest request =
GetProductReviewRequest.newBuilder()
.setName(String.format("accounts/%s/productReviews/%s", accountId, productReviewId))
.build();
System.out.println("Sending get product review request:");
ProductReview response = productReviewsServiceClient.getProductReview(request);
System.out.println("Product review retrieved successfully:");
System.out.println(response.getName());
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
String productReviewId = "YOUR_PRODUCT_REVIEW_ID";
getProductReview(config.getAccountId().toString(), productReviewId);
}
}
प्रॉडक्ट की समीक्षाओं की सूची देखना
बनाई गई प्रॉडक्ट की सभी समीक्षाएं देखने के लिए, productreviews.list तरीके का इस्तेमाल किया जा सकता है.
GET https://merchantapi.googleapis.com/reviews/v1/{parent=accounts/{ACCOUNT_ID}}/productReviews
यहां एक नमूना दिया गया है. इसका इस्तेमाल करके, किसी प्रॉडक्ट की सभी समीक्षाओं की सूची देखी जा सकती है:
Java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.reviews.v1beta.ListProductReviewsRequest;
import com.google.shopping.merchant.reviews.v1beta.ProductReview;
import com.google.shopping.merchant.reviews.v1beta.ProductReviewsServiceClient;
import com.google.shopping.merchant.reviews.v1beta.ProductReviewsServiceClient.ListProductReviewsPagedResponse;
import com.google.shopping.merchant.reviews.v1beta.ProductReviewsServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to list all the product reviews in a given account. */
public class ListProductReviewsSample {
public static void listProductReviews(String accountId) throws Exception {
GoogleCredentials credential = new Authenticator().authenticate();
ProductReviewsServiceSettings productReviewsServiceSettings =
ProductReviewsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
try (ProductReviewsServiceClient productReviewsServiceClient =
ProductReviewsServiceClient.create(productReviewsServiceSettings)) {
ListProductReviewsRequest request =
ListProductReviewsRequest.newBuilder()
.setParent(String.format("accounts/%s", accountId))
.build();
System.out.println("Sending list product reviews request:");
ListProductReviewsPagedResponse response =
productReviewsServiceClient.listProductReviews(request);
int count = 0;
// Iterates over all rows in all pages and prints all product reviews.
for (ProductReview element : response.iterateAll()) {
System.out.println(element);
count++;
}
System.out.print("The following count of elements were returned: ");
System.out.println(count);
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
listProductReviews(config.getAccountId().toString());
}
}
प्रॉडक्ट की समीक्षाएं मिटाना
प्रॉडक्ट की समीक्षा मिटाने के लिए, accounts.productreviews.delete का इस्तेमाल करें. GET तरीके की तरह, इस तरीके के लिए भी प्रॉडक्ट की समीक्षा का नाम वाला फ़ील्ड ज़रूरी है. यह फ़ील्ड, समीक्षा बनाते समय दिखता है.
DELETE https://merchantapi.googleapis.com/reviews/v1/{name=accounts/{ACCOUNT_ID}/productReviews/*}
यहां एक नमूना दिया गया है. इसका इस्तेमाल करके, प्रॉडक्ट की समीक्षा मिटाई जा सकती है:
Java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.reviews.v1beta.DeleteProductReviewRequest;
import com.google.shopping.merchant.reviews.v1beta.ProductReviewsServiceClient;
import com.google.shopping.merchant.reviews.v1beta.ProductReviewsServiceSettings;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to delete a product review. */
public class DeleteProductReviewSample {
public static void deleteProductReview(String accountId, String productReviewId)
throws Exception {
GoogleCredentials credential = new Authenticator().authenticate();
ProductReviewsServiceSettings productReviewsServiceSettings =
ProductReviewsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
try (ProductReviewsServiceClient productReviewsServiceClient =
ProductReviewsServiceClient.create(productReviewsServiceSettings)) {
DeleteProductReviewRequest request =
DeleteProductReviewRequest.newBuilder()
.setName(String.format("accounts/%s/productReviews/%s", accountId, productReviewId))
.build();
System.out.println("Sending delete product review request:");
productReviewsServiceClient.deleteProductReview(request);
System.out.println("Product review deleted successfully");
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
String productReviewId = "YOUR_PRODUCT_REVIEW_ID";
deleteProductReview(config.getAccountId().toString(), productReviewId);
}
}
प्रॉडक्ट की समीक्षा की स्थिति
प्रॉडक्ट की समीक्षा के संसाधन में, अन्य एपीआई की तरह ही स्थिति की जानकारी होती है. यह जानकारी, संसाधन का अहम हिस्सा होती है. साथ ही, यह समस्या और मंज़िल के एक ही स्ट्रक्चर को फ़ॉलो करती है.