รีวิวผู้ขายช่วยให้ผู้คนค้นพบธุรกิจที่มอบประสบการณ์คุณภาพสูงให้กับลูกค้า ซึ่งจะสร้างความน่าเชื่อถือและช่วยให้ลูกค้ามีข้อมูลประกอบการตัดสินใจซื้อมากขึ้น ด้วยเหตุนี้ คะแนนร้านค้าจึงช่วยให้ธุรกิจ ปรับปรุงประสิทธิภาพของโฆษณาและข้อมูลทั่วไป รวมถึงดึงดูดลูกค้าที่เข้าเกณฑ์ ไปยังหน้า Landing Page ได้มากขึ้น
หน้านี้อธิบายวิธีจัดการรีวิวผู้ขายโดยใช้ 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
และรหัสของรีวิวผู้ขาย
เป็นส่วนหนึ่งของช่องชื่อ เมธอด 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 อื่นๆ ซึ่งเป็น ส่วนสำคัญของแหล่งข้อมูลและมีโครงสร้างปัญหาและปลายทางเดียวกัน