รีวิวผู้ขายช่วยให้ผู้คนค้นพบธุรกิจที่มอบประสบการณ์คุณภาพสูงให้กับลูกค้า ซึ่งจะสร้างความน่าเชื่อถือและช่วยให้ลูกค้ามีข้อมูลประกอบการตัดสินใจซื้อมากขึ้น ด้วยเหตุนี้ คะแนนร้านค้าจึงช่วยให้ธุรกิจปรับปรุงประสิทธิภาพของโฆษณาและข้อมูลทั่วไป รวมถึงดึงดูดลูกค้าที่เข้าเกณฑ์ไปยังหน้า Landing Page ได้มากขึ้น
หน้านี้อธิบายวิธีจัดการรีวิวของผู้ขายโดยใช้ Merchant API
ข้อกำหนดเบื้องต้น
Google จำเป็นต้องให้คุณป้อนข้อมูลที่เฉพาะเจาะจง คุณต้องมีสิ่งต่อไปนี้
- แหล่งข้อมูลรีวิวผู้ขายที่ใช้งานอยู่ใน Google Merchant Center
- บัญชีของคุณต้องลงทะเบียนเข้าร่วมโปรแกรมการจัดประเภทร้านค้า หากไม่แน่ใจว่าได้ลงทะเบียนแล้วหรือยัง ให้ตรวจสอบใน Merchant Center หากไม่ได้ลงทะเบียน ให้ส่งแบบฟอร์มคำขอ
สร้างแหล่งข้อมูล
ใช้เมธอด accounts.dataSources.create เพื่อสร้างฟีดรีวิวของผู้ขาย หากมีฟีดรีวิวของผู้ขายอยู่แล้ว ให้ใช้ accounts.dataSources.get เพื่อดึงข้อมูลช่อง dataSource.name
รูปแบบคำขอมีดังนี้
POST https://merchantapi.googleapis.com/datasources/v1beta/accounts/{ACCOUNT_ID} /dataSources/{DATASOURCE_ID}
ตัวอย่าง
ตัวอย่างนี้แสดงคําขอและการตอบกลับทั่วไป
คำขอ
POST https://merchantapi.googleapis.com/datasources/v1beta/accounts/123/dataSources {"displayName": "test api feed", "merchantReviewDataSource":{} }
การตอบกลับ
{
"name": "accounts/123/dataSources/1000000573361824",
"dataSourceId": "1000000573361824",
"displayName": "test api feed",
"merchantReviewDataSource": {},
"input": "API"
}
ดูข้อมูลเพิ่มเติมได้ที่ภาพรวมของ Merchant Data API
สร้างรีวิวผู้ขาย
คุณสามารถใช้วิธี accounts.merchantReviews.insert
เพื่อสร้างหรืออัปเดตรีวิวผู้ขาย เมธอด accounts.merchantReviews.insert
จะรับทรัพยากร merchantreview
และชื่อแหล่งข้อมูลเป็นอินพุต โดยจะแสดงรีวิวผู้ขายใหม่หรือที่อัปเดตแล้ว หากดำเนินการสำเร็จ การสร้างรีวิวผู้ขายต้องใช้ datasource.name
รูปแบบของคำขอ
POST https://merchantapi.googleapis.com/reviews/v1beta/{parent=accounts/*/}merchantReviews:insert
ศึกษาตัวอย่างรีวิวผู้ขายต่อไปนี้เพื่อเป็นข้อมูลอ้างอิง
POST https://merchantapi.googleapis.com/reviews/v1beta/accounts/{ACCOUNT_ID} /merchantReviews:insert?dataSource=accounts/{ACCOUNT_ID} /dataSources/{DATASOURCE_ID}
merchantReviewId = 'my_own_review'
attributes {
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'
}
หลังจากสร้างรีวิวของผู้ขายแล้ว ระบบอาจใช้เวลา 2-3 นาทีเพื่อให้รีวิวมีผล
ดูรีวิวผู้ขาย
หากต้องการดูรีวิวผู้ขาย ให้ใช้ accounts.merchantReviews.get
ข้อมูลนี้เป็นแบบอ่านอย่างเดียว โดยจะต้องใส่ merchantId
และรหัสของผู้ขายเพื่อรับการตรวจสอบเป็นส่วนหนึ่งของช่องชื่อ เมธอด get จะแสดงทรัพยากรรีวิวของผู้ขายที่เกี่ยวข้อง
เช่น
GET https://merchantapi.googleapis.com/reviews/v1beta/{name=accounts/*/merchantReviews/*}
หากต้องการเรียกข้อมูลผลิตภัณฑ์รายการเดียวสำหรับบัญชี Merchant Center หนึ่งๆ ให้ใช้วิธี google.shopping.merchant.accounts.v1beta.GetProductRequest
ดังที่แสดงในตัวอย่างต่อไปนี้
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.products.v1beta.GetProductRequest;
import com.google.shopping.merchant.products.v1beta.Product;
import com.google.shopping.merchant.products.v1beta.ProductsServiceClient;
import com.google.shopping.merchant.products.v1beta.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/v1beta/accounts/{ACCOUNT_ID} /merchantReviews
ลบรีวิวผู้ขาย
หากต้องการลบรีวิวผู้ขาย ให้ใช้ accounts.merchantReviews.delete
คล้ายกับเมธอด accounts.merchantReviews.get
วิธีนี้ต้องใช้ช่องชื่อของการตรวจสอบผู้ขายที่แสดงผลระหว่างการสร้าง
เช่น
DELETE https://merchantapi.googleapis.com/reviews/v1beta/{name=accounts/*/merchantReviews/*}
สถานะการตรวจสอบผู้ขาย
แหล่งข้อมูลการตรวจสอบผู้ขายมีสถานะที่คล้ายกับ API อื่นๆ ซึ่งเป็นส่วนสำคัญของแหล่งข้อมูลและเป็นไปตามโครงสร้างปัญหาและปลายทางเดียวกัน