Add Product to Store
Adding product to the store
Endpoint
Base URL
http://localhost:8080
Method and Endpoint
POST /api/sellers/current/stores/{store_id}/product
Headers
Authorization: Bearer access_token
Route Param
store_id
: string (required)
Request Body
Request Body
{
"name": "example",
"description": "Example Product Description",
"price": 10000,
"stock": 8,
"images": ["image1-url", "image2-url"]
}
Responses
You will get responses like this:
200 (success)
Response Body
{
"message": "Add Product successfully",
"result": {
"InsertId": "unique-product-id"
}
}
400 (bad request)
Response Body
{
"error": "Invalid request body",
}
400 (bad request)
If the category
is not valid
Response Body
{
"error": "invalid category",
}
#### 400 (bad request)
If the `name` product was exist in `database`
```json filename="Response Body"
{
"error": "name product already added",
}
404 (not found)
If the store
was not found in database
Response Body
{
"error": "store 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 store
data
Response Body
{
"error": "failed to find store"
}