Brand API
The Brand API allows you to create, update, delete, and retrieve optical brands with advanced filtering, search, and pagination. Brands are associated with stores and can be searched and sorted by various criteria. The API supports bulk deletion operations and ensures brands are properly scoped to their respective stores.Endpoint Details
Base URL:https://joptic.jethings.com
Required Headers
Create Brand
Endpoint
Endpoint:POST /brandContent-Type:
application/json
Request Structure
The request body contains the brand name to create a new brand.Request Body
Request Body Fields
| Field | Type | Required | Description |
|---|---|---|---|
brandName | string | ✅ Yes | Name of the brand to create |
Create Brand Examples
Example 1: Create a New Brand
Update Brand
Endpoint
Endpoint:PUT /brand/:idContent-Type:
application/json
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | ✅ Yes | UUID of the brand to update |
Request Structure
The request body contains optional fields to update the brand. Only provided fields will be updated.Request Body
Request Body Fields
| Field | Type | Required | Description |
|---|---|---|---|
brandName | string | No | New name for the brand (max 255 characters) |
The
brandName field is optional. If not provided, the brand name will remain unchanged. Only fields that are explicitly provided will be updated.Update Brand Examples
Example 1: Update Brand Name
Delete Brands
Endpoint
Endpoint:DELETE /brandContent-Type:
application/json
Request Structure
The request body contains an array of brand IDs to delete. This endpoint performs a bulk delete operation, removing the brand-store relationships (soft delete by settingisActive to false).
Request Body
Request Body Fields
| Field | Type | Required | Description |
|---|---|---|---|
ids | string[] | ✅ Yes | Array of brand UUIDs to delete (must not be empty) |
Delete Brands Examples
Example 1: Delete Single Brand
Example 2: Bulk Delete Multiple Brands
Get All Brands
Endpoint
Endpoint:GET /brand
Query Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
search | string | No | - | Search brands by name (partial match) |
page | number | No | 1 | Page number for pagination |
limit | number | No | 10 | Number of records per page |
sortBy | string | No | createdAt | Sort field: “name”, “createdAt”, or “updatedAt” |
sortOrder | string | No | desc | Sort order: “asc” or “desc” |
The
storeId is automatically extracted from the x-store-id header and does not need to be provided as a query parameter.Sort Options
ThesortBy parameter accepts the following values:
"name"- Sort by brand name alphabetically"createdAt"- Sort by creation date (default)"updatedAt"- Sort by last update date
Get Brands Examples
Example 1: Get All Brands (Default Pagination)
Example 2: Search Brands with Filters
Example 3: Get Brands Sorted by Update Date
Response Structures
Create Brand Response
Update Brand Response
Delete Brands Response
Get Brands Response
Error Responses
400 Bad Request
404 Not Found
403 Forbidden
500 Internal Server Error
Important Notes
Store Association
Brand-Store Relationship
Brand-Store Relationship
- Brands are associated with stores through
brandStoreRelation - Only brands with active store relations are returned in GET requests
- The
storeIdparameter filters brands for the specified store - Brands must have
isActive: truein the store relation to appear in results - When creating a brand, it’s automatically associated with the store via
x-store-idheader
Store Access
Store Access
- Requires user to have access to the store
- Store access is validated via
x-store-idheader - Missing or invalid store access raises
ForbiddenException - Update and delete operations verify that the brand belongs to the specified store
Update Operations
Update Operations
- Only brands that belong to the store (via active
brandStoreRelation) can be updated - The brand must exist and have an active relationship with the store
- If brand doesn’t exist or doesn’t belong to the store, a
NotFoundExceptionis raised - Only provided fields in the request body will be updated
- The
updatedAttimestamp is automatically updated
Delete Operations
Delete Operations
- Delete operations perform a soft delete by setting
isActive: falseinbrandStoreRelation - Only brands that belong to the store can be deleted
- Invalid or non-existent brand IDs are filtered out before deletion
- The response includes the count of successfully deleted brands
- If no valid brands are found, a
NotFoundExceptionis raised
Search Functionality
Partial Match
Search uses
LIKE query with wildcards%searchTerm%Case Insensitive
Search is case-insensitive
Matches “acme”, “Acme”, “ACME”Pagination
- Default Behavior
- Custom Pagination
Sorting Options
The API supports sorting by:- Name (
sortBy=name) - Alphabetical sorting - Created At (
sortBy=createdAt) - Creation timestamp (default) - Updated At (
sortBy=updatedAt) - Last update timestamp
asc) and descending (desc) orders are supported.
Pagination Metadata
The pagination object includes:page- Current page numberlimit- Number of items per pagetotal- Total number of brands matching the querytotalPages- Total number of pageshasNext- Boolean indicating if there’s a next pagehasPrev- Boolean indicating if there’s a previous page
Summary
1
Authenticate
Obtain JWT token and ensure store access
2
Create Brand
POST request with brand name to create a new brand (automatically associated with store)
3
Retrieve Brands
GET request with optional filters, search, and pagination
4
Update Brand
PUT request with brand ID and optional brandName to update brand details
5
Delete Brands
DELETE request with array of brand IDs to bulk delete brands (soft delete)
6
Handle Response
Process brand data, pagination metadata, or deletion confirmation