Overview
A2Reviews Client API lets you build apps, extensions or plugins to get reviews from the A2reviews APP. Including adding reviews to a store's products. It is used to import and export reviews through the API. This is the official package built and developed by A2Reviews, Inc.
Requirements
Installation
Execute the following command to get the package:
composer require eosvn/a2reviews-client-api
Usage
Create an instance of the A2Reviews Client, then used to access the A2Reviews Client API.
require_once __DIR__ . "/vendor/autoload.php";
$a2Review = new EOSVN\A2ReviewsClient\A2ReviewsClient([
'api_key' => '{A2Review_API_Key}',
'api_secret' => '{A2Review_API_Secret}',
]);
Examples
In the examples below we just used some parameters as a demo. For detailed parameters please visit our documentation.
Product Reviews
APIs for reviews of product, allows to get the reviews of a product or all products. Make it possible to deploy on different platforms.
Get product reviews
$response = $a2Review->review->getProductReviews([
'handle' => '{product_handle}',
'limit' => 2 // Number record per page
]);
Get feature reviews
$response = $a2Review->review->getFeatureReviews([
'limit' => 2
]);
Get block list reviews
$response = $a2Review->review->getBlockListReviews([
'limit' => 2
]);
Get block reviews
$response = $a2Review->review->getBlockReviews([
'limit' => 2
]);
Write review to product
$response = $a2Review->review->addReviewToProduct([
'handle' => '{product_handle}',
'review' => [
'rating' => 4,
'title' => 'Package title review.',
'author' => 'Author name',
'email' => '[email protected]',
'content' => 'Package content review.'
]
]);
Update a review
$response = $a2Review->review->updateReview([
'id' => '{review_id}',
'handle' => '{product_handle}',
'review' => [
'rating' => 2,
'title' => 'Package title review (update).',
'author' => 'Author name',
'email' => '[email protected]',
'content' => 'Package content review.'
]
]);
Update image review
$response = $a2Review->review->updateImageReview([
'id' => '{review_id}',
'handle' => '{product_handle}',
'image' => [
'attachment' => '{image data base64}',
'filename' => '{filename}'
]
]);
Client Site Settings
APIs for client site, allows to get the settings global, setting languages.
Get global settings
$response = $a2Review->setting->getGlobalSettings();
Get reviews languages
$response = $a2Review->setting->getReviewLanguages();
Get questions answers language
$response = $a2Review->setting->getQuestionAnswerLanguages();
Get common languages
$response = $a2Review->setting->getCommonLanguages();
After request, using below way to get data
$response->getData();
Documentation
A2Reviews - Official Client API Documentation
Changelog
Please see CHANGELOG for more information what has changed recently.
Security
If you discover a security vulnerability within a2reviews-client-api, please send an e-mail to A2Reviews, Inc via [email protected]. All security vulnerabilities will be promptly addressed.
Credits
License
The Laravel framework is open-sourced software licensed under the MIT license.