Brand API
This documentation provides comprehensive details for the Brand API endpoints. The API supports creating, retrieving, updating, and deleting brands within the platform. Brands are independent entities that can be associated with products and managed by administrators or authorized users.
Base URL: http://localhost:8080
Authentication
All Brand endpoints require Bearer token authentication. Include the access token in the Authorization header:
Authorization: Bearer <your_access_token>
Brand Endpoints
Method |
Endpoint |
Description |
Authentication Required |
POST |
/brand |
Create a new brand |
Yes |
GET |
/brand |
Retrieve list of brands |
Yes |
PUT |
/brand/{id} |
Update an existing brand |
Yes |
DELETE |
/brand/{id} |
Delete a brand |
Yes |
Endpoint Details
1. Create Brand
POST /brand
Create a new brand with a specified name.
Query Parameters
Parameter |
Type |
Required |
Description |
name |
string |
Yes |
Name of the brand |
Header |
Value |
Required |
Authorization |
Bearer <access_token> |
Yes |
Example Request
curl -X 'POST' \
'http://localhost:8080/brand?name=Nike' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...' \
-d ''
Example Response
{
"isSuccess": true,
"statusCode": {
"value": 200,
"description": "OK"
},
"data": {
"id": "6c5078d3-f8e3-4c88-9afe-48b5423c664f",
"name": "Nike"
}
}
Response Fields
Field |
Type |
Description |
id |
string |
Unique identifier for the created brand |
name |
string |
Name of the brand |
2. Get Brands
GET /brand
Retrieve a list of brands with optional pagination support.
Query Parameters
Parameter |
Type |
Required |
Description |
limit |
number |
No |
Maximum number of brands to return (default: 10) |
offset |
number |
No |
Number of brands to skip for pagination |
Header |
Value |
Required |
Authorization |
Bearer <access_token> |
Yes |
Example Request
curl -X 'GET' \
'http://localhost:8080/brand?limit=10' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...'
Example Response
{
"isSuccess": true,
"statusCode": {
"value": 200,
"description": "OK"
},
"data": [
{
"id": "6c5078d3-f8e3-4c88-9afe-48b5423c664f",
"name": "Nike"
},
{
"id": "19dd1021-432c-473c-8b19-0f56d19af9ad",
"name": "PUMA"
}
]
}
Response Fields
Field |
Type |
Description |
data |
array |
Array of brand objects |
data[].id |
string |
Unique identifier for the brand |
data[].name |
string |
Name of the brand |
3. Update Brand
PUT /brand/{id}
Update an existing brand by its ID. You can modify the brand name.
Path Parameters
Parameter |
Type |
Required |
Description |
id |
string |
Yes |
Unique identifier of the brand to update |
Query Parameters
Parameter |
Type |
Required |
Description |
name |
string |
Yes |
New name for the brand |
Header |
Value |
Required |
Authorization |
Bearer <access_token> |
Yes |
Example Request
curl -X 'PUT' \
'http://localhost:8080/brand/6c5078d3-f8e3-4c88-9afe-48b5423c664f?name=Addidas' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...'
Example Response
{
"isSuccess": true,
"statusCode": {
"value": 200,
"description": "OK"
},
"data": {
"id": "6c5078d3-f8e3-4c88-9afe-48b5423c664f",
"name": "Addidas"
}
}
Response Fields
Field |
Type |
Description |
id |
string |
Unique identifier of the updated brand |
name |
string |
Updated name of the brand |
4. Delete Brand
DELETE /brand/{id}
Delete a brand by its ID. This operation permanently removes the brand from the system.
Path Parameters
Parameter |
Type |
Required |
Description |
id |
string |
Yes |
Unique identifier of the brand to delete |
Header |
Value |
Required |
Authorization |
Bearer <access_token> |
Yes |
Example Request
curl -X 'DELETE' \
'http://localhost:8080/brand/19dd1021-432c-473c-8b19-0f56d19af9ad' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9...'
Example Response
{
"isSuccess": true,
"statusCode": {
"value": 200,
"description": "OK"
},
"data": "19dd1021-432c-473c-8b19-0f56d19af9ad"
}
Response Fields
Field |
Type |
Description |
data |
string |
ID of the deleted brand |
All API responses follow a consistent format:
{
"isSuccess": boolean,
"statusCode": {
"value": number,
"description": string
},
"data": any
}
Response Fields
Field |
Type |
Description |
isSuccess |
boolean |
Indicates if the operation was successful |
statusCode.value |
number |
HTTP status code |
statusCode.description |
string |
HTTP status description |
data |
any |
Response data (varies by endpoint) |
Error Handling
The API returns appropriate HTTP status codes and error messages:
Status Code |
Description |
200 |
OK - Request successful |
400 |
Bad Request - Invalid parameters or missing required fields |
401 |
Unauthorized - Invalid or missing authentication |
403 |
Forbidden - Insufficient privileges |
404 |
Not Found - Brand not found |
409 |
Conflict - Brand name already exists |
500 |
Internal Server Error - Server error |