# Wishlist Screen

## **Wishlist API**

The Wishlist API allows customers to manage their wishlist on the e-commerce platform, enabling them to add and remove products they are interested in purchasing later. The API offers endpoints for viewing the wishlist, adding products to the wishlist, and removing products from the wishlist.

<figure><img src="https://3686328336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fd1Iq7THDAagTQzeC9rTN%2Fuploads%2F85YfGEj6zSoKVQW2kOEP%2Fimage.png?alt=media&#x26;token=d6122e79-4133-4e9e-9704-2636572f9396" alt=""><figcaption><p>Wishlist interface</p></figcaption></figure>

### **1. Get Wishlist API**

The Get Wishlist API retrieves the list of products that the customer has added to their Wishlist.

### **Endpoint**

* `{{baseurl}}/api/v1/wishlists`

### **Method**

* **GET**

### **Request Parameters**

* `lang_code` (optional): The two-letter language code used to retrieve product names and details in a specific language. If provided, the API returns product information in the specified language.

### **Authorization**&#x20;

The API requires a valid bearer token in the request header for authentication. Users must include their token in the "Authorization" header to access their wishlist.

### **Response Format**&#x20;

The API responds with a JSON array containing wishlist items. Each item represents a product in the wishlist and includes details such as the product ID, name, country variation ID, and other relevant information.

Example Response:

```json
{
    "success": true,
    "data": {
        "wishlists": [
            {
                "id": 76,
                "product_id": 21,
                "product_name": "Body-Contouring Bandage Mini Dress",
                "thumbnail": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/502-B.jpg",
                "mrp_price": 435,
                "offer_price": 1000,
                "offer_label": 10,
                "avg_rating": 4,
                "total_ratings": 1,
                "is_wishlisted": "yes",
                "is_bundle": 0
            },
            {
                "id": 78,
                "product_id": 57,
                "product_name": "Superhero Emblem Sticker Set",
                "thumbnail": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/71srbo5I7VL._SL1500_.jpg",
                "mrp_price": 110,
                "offer_price": 90,
                "offer_label": 0,
                "avg_rating": 0,
                "total_ratings": 0,
                "is_wishlisted": "yes",
                "is_bundle": 0
            },
            {
                "id": 107,
                "product_id": 59,
                "product_name": "Tribal Art Temporary Tattoos",
                "thumbnail": "https://majarat-developemt.s3.ap-southeast-1.wasabisys.com/uploads/all/81l0I%2BhI1VL._SL1500_.jpg",
                "mrp_price": 150,
                "offer_price": 90,
                "offer_label": 0,
                "avg_rating": 0,
                "total_ratings": 0,
                "is_wishlisted": "yes",
                "is_bundle": 0
            }
        ]
    },
    "message": "Success",
    "status_code": 200
}
```

###

###

###

### **2. Add to Wishlist API**

The Add to Wishlist API allows customers to add products to their wishlist.

### **Endpoint**

* `{{baseurl}}/api/v1/wishlist/store`

### **Method**

* **POST**

### **Request Body**&#x20;

The API expects a JSON object containing the following parameters:

* `product_id`: The unique identifier of the product to be added to the wishlist.
* `country_variation_id`: The specific country variation of the product selected (if applicable).

Example Request Body:

```json
{
  "product_id": 12345,
  "country_variation_id": 6789
}
```

### **Authorization**

&#x20;The API requires a valid bearer token in the request header for authentication and user authorization. Users must provide a token to access their personalized wishlist.

### **Response Format**&#x20;

The API responds with a JSON object indicating the status of the wishlist addition request. It provides information about the added product, including the product ID, name, and other details.

Example Response:

```json
{
    "status": true,
    "message": "Product Added to wishlist",
    "data": []
}
```

###

###

###

### **3. Remove from Wishlist API**

The Remove from Wishlist API allows customers to remove a specific product from their wishlist.

### **Endpoint**

* `{{baseurl}}/api/v1/wishlist/destroy/{wishlist_id}`

### **Method**

* **GET**

### **Request Parameter**

* `wishlist_id` (required): The unique identifier of the product in the wishlist that the customer wants to remove.

### **Authorization**&#x20;

The API requires a valid bearer token in the request header for authentication and user authorization. Users must provide a token to access their personalized wishlist.

### **Response Format**&#x20;

The API responds with a JSON object indicating the status of the wishlist removal request. If successful, it provides a success message.

Example Response:

```json
{
    "success": true,
    "message": "Successfully removed from wishlist",
    "status_code": 200
}
```

### **Features**

* The Wishlist API allows customers to maintain a list of products they are interested in purchasing later.
* Customers can view their wishlist, add products to it, and remove products from it as needed.
* The API provides product information, such as the product ID, name, country variation ID, thumbnail, price, discount, and final price, to help customers make informed decisions.

### **Usage**

* The Get Wishlist API is used to retrieve the list of products in the customer's wishlist, displaying them on the wishlist page in the e-commerce application.
* The Add to Wishlist API is utilized when customers browse the product catalog and find products they want to save for future reference.
* The Remove from Wishlist API is used when customers decide to remove a product from their wishlist, keeping the list up-to-date with their preferences.

By offering wishlist management capabilities, the Wishlist API enhances the user experience, allowing customers to plan their purchases and keep track of products they intend to buy.
