Products
Get Data Product

Get Product Data

Fetch data product by product id

Endpoint

Base URL
http://localhost:8080
Method and Endpoint
GET /api/sellers/current/stores/{store_id}/product
Headers
Authorization: Bearer access_token

Route Param

store_id : string (required)

Query Param

product_id : string (required)

Responses

You will get responses like this:

200 (success)

Response Body
{
  "message": "Fetch product Successfully",
  "product": {
    "name": "example-product-name",
    "description": "example-product-desc",
    "price": 99.99,
    "stock": 150,
    "average_rating": 4.5,
    "total_sales": 2500,
    "product_id": "WH123456",
    "category": "Electronics",
    "created_at": "2024-05-30T20:13:21.370Z",
    "store_name": "store-name",
    "city": "store-city",
    "images": [
      "https://example.com/images/product1.jpg",
      "https://example.com/images/product2.jpg"
    ]
  }
}

404 (not found)

If the store was not found in database

Response Body
{
  "error": "store not found"
}

404 (not found)

If the product was not found in database

Response Body
{
  "error": "product not found"
}

401 (unauthorized)

Response Body
{
  "error": "Invalid authorization header"
}

401 (unauthorized - expire token)

Response Body
{
  "error": "token is expired: token is expired by 2m19s"
}

500 (server error)

Response Body
{
  "error": "Internal server error"
}

500 (server error - failed)

If query to database get troble while get the product data

Response Body
{
  "error": "failed to get the product"
}