Product SEO Service
Overview
The Product SEO module manages search engine optimization metadata for individual products.
It allows assigning and maintaining SEO-related fields such as:
- meta title
- meta description
- URL slug
- canonical URL
Each product can have at most one SEO record.
This module:
- does not manage product data
- does not generate SEO automatically
- operates strictly on a per-product basis
All operations are tenant-aware and fully audited.
Endpoints
GET
/api/v1/ProductSEO/GetProductSEOByProductId/{productId}
Returns SEO metadata assigned to a specific product.
Behavior:
- Looks up SEO data by
ProductId - Returns
404if no SEO record exists for the product
Response:
ProductSEOModel
Authorization:
- Requires Bearer Token
GET
/api/v1/ProductSEO/GetProductSEOBySlug/{slug}
Returns SEO metadata by URL slug.
Behavior:
- Looks up SEO record by
Slug - Slugs are expected to be unique
- Returns
404if no SEO record matches the slug
Response:
ProductSEOModel
Authorization:
- Requires Bearer Token
POST
/api/v1/ProductSEO/AddNewProductSEO
Creates a new SEO record for a product.
Request body:
ProductId(long, required)MetaTitle(string, required)MetaDescription(string, required)Slug(string, required)CanonicalUrl(string, required)
Behavior:
- Each product can have only one SEO record
- Canonical URL must be a valid absolute URL
- Slug is normalized before saving:
- trimmed
- converted to lowercase
- spaces replaced with
-
- Prevents duplicate slugs across all products
- Validation is enforced in the service layer
- Successful creation writes an audit log entry
Errors:
- Returns
400if:- validation -
- SEO record already exists for the product
- CanonicalUrl is not a valid absolute URL
- Slug already exists (after normalization)
Authorization:
- Requires Bearer Token
PUT
/api/v1/ProductSEO/UpdateProductSEOByProductId/{productId}
Updates SEO metadata for a product.
Request:
productIdis taken from the route- Body must include a valid
ProductSEOModel
Behavior:
- Updates existing SEO record only
- Validation is enforced in the service layer (
IsValid()requires all fields) - Slug is normalized before saving:
- trimmed
- converted to lowercase
- spaces replaced with
-
- Prevents duplicate slugs across all products (excluding the current product)
- Canonical URL must be a valid absolute URL
- Successful update writes an audit log entry
Errors:
- Returns
400if:- validation -
- SEO record does not exist
- CanonicalUrl is not a valid absolute URL
- Slug already exists (after normalization)
Authorization:
- Requires Bearer Token
DELETE
/api/v1/ProductSEO/DeleteProductSEOByProductId/{productId}
Deletes SEO metadata for a product.
Behavior:
- Removes the SEO record associated with the given product
- Does not affect the product itself
- Successful deletion writes an audit log entry
Errors:
- Returns
400if:- SEO record does not exist
Authorization:
- Requires Bearer Token
Notes
- Exactly one SEO record per product is allowed
- Slug uniqueness is enforced on creation (after normalization)
- Slug normalization currently includes:
- trim
- lowercase conversion
- space replacement with
-
- SEO data is not generated automatically
- All validation is handled in the service layer
- All state-changing operations are audited
- Internal errors are logged and not exposed to API consumers