This endpoint allows store owners to update their store’s brand name and description. Only the store owner can update their own store.
Authentication
Required: Bearer token in Authorization header
Permission: You must be the owner of the store (VendorOnly permission)
Path Parameters
The URL slug of the store to update (derived from brand_name)
Request Body
Updated brand name for the store. If omitted, keeps current value.
Updated description of the store. If omitted, keeps current value.
Both fields are optional in the update request. Only include fields you want to change.
Response
Returns the updated store object:
Unique identifier for the store
Hyperlinked URL to the store detail endpoint (uses slug)
Total number of products sold by this store
Customer ID of the store owner
Array of customer IDs following this store
Example Request
curl -X PUT http://localhost:8000/api/v1/stores/tech-gadgets-pro/ \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"about": "Premium electronics, accessories, and smart home devices for tech enthusiasts"
}'
import requests
url = "http://localhost:8000/api/v1/stores/tech-gadgets-pro/"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
}
data = {
"about": "Premium electronics, accessories, and smart home devices for tech enthusiasts"
}
response = requests.put(url, headers=headers, json=data)
print(response.json())
Example Response
{
"id": 5,
"url": "http://localhost:8000/api/v1/stores/tech-gadgets-pro/",
"brand_name": "Tech Gadgets Pro",
"about": "Premium electronics, accessories, and smart home devices for tech enthusiasts",
"products_sold": 47,
"owner": 42,
"followers": [15, 23, 108]
}
Error Responses
400 Bad Request
Returned when brand name conflicts with another store:
{
"brand_name": ["store with this brand name already exists."]
}
401 Unauthorized
Returned when authentication token is missing or invalid:
{
"detail": "Authentication credentials were not provided."
}
403 Forbidden
Returned when you try to update a store you don’t own:
{
"detail": "You do not have permission to perform this action."
}
404 Not Found
Returned when the store slug doesn’t exist:
{
"detail": "Not found."
}
Business Rules
- Only the store owner can update their store
- Brand name changes will update the URL slug
- Changing the brand name does not affect existing product associations
- Products sold count and follower list cannot be directly modified through this endpoint
Changing the brand name will change the store’s URL slug. Update any bookmarks or links accordingly.
Code Reference
Implementation: ~/workspace/source/stores/views.py:68-76