Shop API Documentation
Base URL:
All endpoints in this API are prefixed with /api/v1/shop/. The following sections detail the available endpoints for shop-related operations.
Endpoints
1. List All Shops
- Endpoint:
/api/v1/shop/list/ - Method:
GET - Description: Retrieves a list of all shops, ordered by the last updated time.
- Permissions:
AllowAny - Response: List of shops serialized using
ShopSerializer.
Payload:
Response
[
{
"id": "1",
"name": "Shop 1",
"description": "Shop 1 description",
"avg_rating": 4.5,
"follower_count": 100,
"created_at": "2023-10-01T10:00:00Z",
"updated_at": "2023-10-10T12:00:00Z"
},
{
"id": "2",
"name": "Shop 2",
"description": "Shop 2 description",
"avg_rating": 4.0,
"follower_count": 50,
"created_at": "2023-09-15T09:30:00Z",
"updated_at": "2023-09-20T11:45:00Z"
}
]
2. List Products of a Shop
- Endpoint:
/api/v1/shop/product/list/ - Method:
GET - Description: Retrieves a paginated list of products within a shop, with optional filters, search, and ordering.
- Query Parameters:
shop: Filter products by shop ID.color,brand,fabric: Filter by product attributes.min_price,max_price: Filter by price range.category,subcategory: Filter by category.discount_range: Filter by discount percentage.rating: Filter by minimum rating.- Permissions:
AllowAny - Response: A paginated list of products serialized using
ProductSerializer.
3. Retrieve Shop Details
- Endpoint:
/api/v1/shop/detail/<str:pk>/ - Method:
GET - Description: Retrieves details of a specific shop based on its unique ID.
- Permissions:
AllowAny - Response: Serialized details of the shop.
Payload:
Response
{
"id": 2,
"vendor": {
"user": 11,
"company_name": "Le Lord",
"telephone": "9808141077",
"company_created_at": "2024-12-16",
"company_address": "Radhe Radhe, Bhaktapur",
"created_at": "12-16-2024 10:39:06",
"updated_at": "12-16-2024 10:39:06"
},
"follower_count": 0,
"rating_reviews": [],
"average_ratings": {
"overall_average": 0,
"total_ratings": 0,
"average_per_star": {
"5_star": 0,
"4_star": 0,
"3_star": 0,
"2_star": 0,
"1_star": 0
}
},
"description": "LeLord is famous shop around recent growing city Radhe Radhe. You get every good products in this shop",
"shop_location": "Radhe Radhe, Bhaktapur",
"shop_image": "http://api.kurtasari.com/media/shop/images/Le_Lord_-_photo_bWLximN.jpg",
"shop_cover_image": "http://api.kurtasari.com/media/shop/images/Lelord_Cover.jpg",
"created_at": "12-16-2024 10:42:48",
"updated_at": "12-16-2024 10:42:48"
}
4. Create a New Shop
- Endpoint:
/api/v1/shop/create/ - Method:
POST - Description: Allows a logged-in vendor to create a new shop.
- Permissions:
IsAuthenticated - Validation: Ensures the vendor does not already own a shop.
- Response: Created shop details or an error message.
Payload:
Request
{
"name": "New Shop",
"description": "This is a description of the new shop."
}
{
"id": "3",
"name": "New Shop",
"description": "This is a description of the new shop.",
"avg_rating": 0,
"follower_count": 0,
"created_at": "2024-12-18T14:00:00Z",
"updated_at": "2024-12-18T14:00:00Z"
}
5. Update Shop Details
- Endpoint:
/api/v1/shop/update/<str:pk>/ - Method:
PATCH - Description: Updates the details of the shop owned by the logged-in vendor.
- Permissions:
IsAuthenticated - Validation: Ensures the shop belongs to the vendor.
- Response: Updated shop details or error message.
Payload:
Request
{
"name": "Updated Shop Name",
"description": "Updated description of the shop."
}
{
"id": "1",
"name": "Updated Shop Name",
"description": "Updated description of the shop.",
"avg_rating": 4.5,
"follower_count": 100,
"created_at": "2023-10-01T10:00:00Z",
"updated_at": "2024-12-18T14:30:00Z"
}
6. Delete Shop
- Endpoint:
/api/v1/shop/delete/<str:pk>/ - Method:
DELETE - Description: Deletes the shop owned by the logged-in vendor.
- Permissions:
IsAuthenticated - Validation: Ensures the shop belongs to the vendor.
- Response: Confirmation message.
Payload:
Response
{
"message": "Shop has been deleted successfully."
}
7. List All Shops with Follower Count
- Endpoint:
/api/v1/shop/follower/list/ - Method:
GET - Description: Lists all shops with the number of followers.
- Permissions:
IsAuthenticated - Response: A list of shops with follower counts, serialized using
ShopFollowersSerializer.
8. Retrieve Followers for a Specific Shop
- Endpoint:
/api/v1/shop/follower/detail/<str:shop_id>/ - Method:
GET - Description: Retrieves the list of followers for a specific shop.
- Permissions:
IsAuthenticated - Response: A list of followers for the specified shop, serialized appropriately.
9. Follow or Unfollow a Shop
- Endpoint:
/api/v1/shop/follower/ - Method:
POST - Description: Allows authenticated users to follow or unfollow a shop. Vendors cannot follow shops.
- Permissions:
IsAuthenticated - Response: Success or error message based on whether the action was successful.
10. List Shops Excluding a Specific Shop
- Endpoint:
/api/v1/shop/more/ - Method:
GET - Description: Retrieves a list of shops excluding the shop with the specified ID.
- Query Parameter:
id: The ID of the shop to exclude from the results.- Permissions:
AllowAny - Response: A list of shops excluding the specified shop, serialized using
ShopSerializer.