Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product Review API #9570

Closed
okorshenko opened this issue May 9, 2017 · 5 comments
Closed

Product Review API #9570

okorshenko opened this issue May 9, 2017 · 5 comments
Assignees
Labels
improvement Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed up for grabs

Comments

@okorshenko
Copy link
Contributor

Overview

Currently, Magento 2 does not provide the REST API for the Reviews Extension of the products. In scope of this task we would implement WebAPI for product reviews and integrate review API into existing core modules

Resources

Resource Request method Permissions Payload Response Implementation Description
/V1/reviews/:id GET Guest, Customer, Admin \Magento\Review\Api\Data\ReviewInterface \Magento\Review\Api\ReviewRepositoryInterface::get Get one review
/V1/reviews/:id PUT Admin \Magento\Review\Api\Data\ReviewInterface \Magento\Review\Api\ReviewRepositoryInterface::save Update review
/V1/reviews/:id DELETE Admin \Magento\Review\Api\ReviewRepositoryInterface::deleteById Delete review
/V1/reviews/ POST Guest, Customer, Admin \Magento\Review\Api\Data\ReviewInterface \Magento\Review\Api\Data\ReviewInterface \Magento\Review\Api\ReviewRepositoryInterface::save Create review
/V1/reviews/ GET Admin \Magento\Framework\Api\SearchCriteriaInterface \Magento\Review\Api\Data\ReviewInterface[] \Magento\Review\Api\ReviewRepositoryInterface::getList Search reviews
/V1/products/:sku/reviews GET Guest, Customer, Admin \Magento\Review\Api\Data\ReviewInterface[] \Magento\Review\Api\ReviewManagementInterface::getProductReviews Get product reviews
/V1/customers/me/reviews GET Customer \Magento\Review\Api\Data\ReviewInterface[] \Magento\Review\Api\ReviewManagementInterface::getCustomerReviews Get reviews created by current customer

Interfaces

\Magento\Review\Api\ReviewRepositoryInterface

namespace Magento\Review\Api;

interface ReviewRepositoryInterface
{
/**
* Save review.
*
* @param \Magento\Review\Api\Data\ReviewInterface $review
* @return \Magento\Review\Api\Data\ReviewInterface
* @throws \Magento\Framework\Exception\CouldNotSaveException
*/
public function save(\Magento\Review\Api\Data\ReviewInterface $review);

/**
 * Get review by id.
 *
 * @param int $id
 * @return \Magento\Review\Api\Data\ReviewInterface
 * @throws \Magento\Framework\Exception\NoSuchEntityException
 */
public function get($id);

/**
 * Delete review.
 *
 * @param \Magento\Review\Api\Data\ReviewInterface $review
 * @return bool
 * @throws \Magento\Framework\Exception\CouldNotDeleteException
 */
public function delete(\Magento\Review\Api\Data\ReviewInterface $review);

/**
 * Delete review by id.
 *
 * @param int $id
 * @return bool
 * @throws \Magento\Framework\Exception\CouldNotDeleteException
 */
public function deleteById($id);


/**
 * Lists the review items that match specified search criteria.
 *
 * @param \Magento\Framework\Api\SearchCriteria $searchCriteria
 * @return \Magento\Review\Api\Data\ReviewSearchResultInterface
 */
public function getList(\Magento\Framework\Api\SearchCriteria $searchCriteria);

}

\Magento\Review\Api\ReviewManagementInterface

namespace Magento\Review\Api;

interface ReviewManagementInterface
{
/**
* Get customer's reviews.
*
* @param int $customerId
* @return ReviewInterface[]
*/
public function getCustomerReviews($customerId);

/**
 * Get product reviews.
 *
 * @param string $sku
 * @return ReviewInterface[]
 */
public function getProductReviews($sku);

}

\Magento\Review\Api\Data\ReviewInterface

namespace Magento\Review\Api\Data;
 
interface ReviewInterface
{
    /**
     * Get review id.
     *
     * @return int
     /
    public function getId();
 
    /
*
     * Get Review title.
     *
     * @return string
     /
    public function getTitle();
 
    /
*
     * Get Review detail.
     *
     * @return string
     /
    public function getDetail();
 
    /
*
     * Get author nickname.
     *
     * @return string
     /
    public function getNickname();
 
    /
*
     * Get customer id.
     *
     * @return int|null
     /
    public function getCustomerId();
 
    /
*
     * Get review ratings.
     *
     * @return RatingInterface[]
     /
    public function getRatings();
 
    /
*
     * Get review entity type.
     *
     * @return string
     /
    public function getReviewEntity();
 
    /
*
     * Get reviewer type.
     * Possible values: 1 - Customer, 2 - Guest, 3 - Administrator.
     *
     * @return int
     /
    public function getReviewType();
 
    /
*
     * Get review status.
     * Possible values: 1 - Approved, 2 - Pending, 3 - Not Approved.
     *
     * @return int
     /
    public function getReviewStatus();
 
    /
*
     * Set review id.
     *
     * @param int $value
     * @return void
     /
    public function setId($value);
 
    /
*
     * Set Review title.
     *
     * @param string $value
     * @return void
     /
    public function setTitle($value);
 
    /
*
     * Set Review detail.
     *
     * @param void $value
     * @return void
     /
    public function setDetail($value);
 
    /
*
     * Set author nickname.
     *
     * @param string $value
     * @return void
     /
    public function setNickname($value);
 
    /
*
     * Set customer id.
     *
     * @param int|null $value
     * @return void
     /
    public function setCustomerId($value);
 
    /
*
     * Set review ratings.
     *
     * @param RatingInterface[] $value
     * @return void
     /
    public function setRatings($value);
 
    /
*
     * Set review entity type.
     *
     * @param string $value
     * @return void
     /
    public function setReviewEntity($value);
 
    /
*
     * Set review status.
     * Possible values: 1 - Approved, 2 - Pending, 3 - Not Approved.
     *
     * @param int $value
     * @return void
     /
    public function setReviewStatus($value);
 
    /
*
     * Set reviewer type.
     * Possible values: 1 - Customer, 2 - Guest, 3 - Administrator.
     *
     * @param int $value
     * @return string
     */
    public function setReviewType($value);
}

\Magento\Review\Api\Data\RatingInterface

namespace Magento\Review\Api\Data;

interface RatingInterface
{
/**
* Get rating id.
*
* @return int|null
*/
public function getId();

/**
 * Get review id.
 *
 * @return int
 */
public function getReviewId();

/**
 * Get rating code.
 *
 * @return string
 */
public function getAttributeCode();

/**
 * Get rating value.
 *
 * @return int
 */
public function getValue();

/**
 * Set rating id.
 *
 * @param int|null $value
 * @return void
 */
public function setId($value);

/**
 * Set review id.
 *
 * @param int $value
 * @return void
 */
public function setReviewId($value);

/**
 * Set rating code.
 *
 * @param string $value
 * @return void
 */
public function setAttributeCode($value);

/**
 * Set rating value.
 *
 * @param int $value
 * @return void
 */
public function setValue($value);

}

@magento-engcom-team
Copy link
Contributor

No activity. Closing the issue

@Koc
Copy link

Koc commented Nov 16, 2017

@okorshenko

okorshenko moved this from TODO to Done in Community Dashboard 9 days ago

does it really done?

@gaoyong06
Copy link

@okorshenko @Koc does it really done???

@okorshenko
Copy link
Contributor Author

No. The task is not implemented

@thiagosantos
Copy link

And it will ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed up for grabs
Projects
None yet
Development

No branches or pull requests

7 participants