Skip to content

Re-engineering from scratch a legacy backend service for a fashion e-commerce website. Service handled 1,100 client RPS with 0.0% error rate and <2,000-ms latency with a logging system in place.

Notifications You must be signed in to change notification settings

Fashion-Island/RatingsReviewsAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RatingsReviewsAPI

This project re-engineered a legacy backend service of a fashion e-commerce website from scratch.

Endpoints

List Reviews

GET /reviews/: Returns a list of reviews for a particular product. This list does not include any reported reviews.

Query parameters:

Parameter Data type Description
page integer Selects the page of results to return. Default 1.
count integer Specifies how many results per page to return. Default 5.
sort text Changes the sort order of reviews to be based on "newest", "helpful", or "relevant"
product_id integer Specifies the product for which to retrieve reviews.

Sample response: Status: 200 OK

{
    "product": "40346",
    "page": 0,
    "count": 10,
    "results": [
        {
            "review_id": 1275831,
            "rating": 4,
            "summary": "This is a Test!",
            "recommend": false,
            "response": null,
            "body": "PLEASE WORK, NEED ADDITIONAL CHARACTERS... MORE CHARACTERS...",
            "date": "2022-07-22T00:00:00.000Z",
            "reviewer_name": "DARTH VADER",
            "helpfulness": 1,
            "photos": []
        },
        {
            "review_id": 1275829,
            "rating": 5,
            "summary": "Testing1",
            "recommend": true,
            "response": null,
            "body": "Testing1Testing1Testing1Testing1Testing1Testing1Testing1",
            "date": "2022-07-22T00:00:00.000Z",
            "reviewer_name": "Testing1",
            "helpfulness": 0,
            "photos": []
        },
        ...
    ]
}
Get Review Metadata

GET /reviews/meta: Returns review metadata for a given product.

Query parameters:

Parameter Data type Description
product_id integer Required ID of the product for which data should be returned

Sample response: Status: 200 OK

{
    "product_id": "40346",
    "ratings": {
        "1": "13",
        "2": "39",
        "3": "27",
        "4": "18",
        "5": "43"
    },
    "recommended": {
        "false": "41",
        "true": "99"
    },
    "characteristics": {
        "Fit": {
            "id": 135224,
            "value": "2.4000000000000000"
        },
        "Length": {
            "id": 135225,
            "value": "3.1485148514851485"
        },
        "Comfort": {
            "id": 135226,
            "value": "2.8039215686274510"
        },
        "Quality": {
            "id": 135227,
            "value": "3.1237113402061856"
        }
    }
}
Add a Review

POST /reviews: Adds a review for the given product.

Body parameters:

Parameter Data type Description
product_id integer Required ID of the product to post the review for
rating integer Integer (1-5) indicating the review rating
summary text Summary text of the review
body text Continued or full text of the review
recommended boolean Value indicating if the reviewer recommends the product
name text Username for reviewer
email text Email address for reviewer
photos [text] Array of text URLs that link to images to be shown
characteristics object Object of keys representing `chracteristic_id` and values representing the review value for that characteristics. i.e.: `{"14": 5, "15": 5 //...}`

Sample response: Status: 201 CREATED

Mark Review as Helpful

PUT /reviews/:review_id/helpful: Updates a review to show it was found helpful.

Parameters:

Parameter Data type Description
review_id integer Required ID of the review to update

Sample response: Status: 204 NO CONTENT

Report Review

PUT /reviews/:review_id/report: Updates a review to show it was reported. Note, this action does not delete the review, but the review will not be returned in the above GET request.

Parameters:

Parameter Data type Description
review_id integer Required ID of the review to update

Sample response: Status: 204 NO CONTENT

About

Re-engineering from scratch a legacy backend service for a fashion e-commerce website. Service handled 1,100 client RPS with 0.0% error rate and <2,000-ms latency with a logging system in place.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published