Country Service
Overview
Countries represent nation-level reference data used across sales, pricing, promotions, and inventory modules.
They provide a consistent reference for:
- validating addresses and customer locations
- filtering and reporting
- pricing and tax calculations
- country-specific promotions and rules
Countries are tenant-scoped and managed independently. Removing a country does not automatically modify related data.
All country operations are tenant-aware and scoped to the current tenant.
Endpoints
GET
/api/v1/Country/GetAllCountries
Returns all countries for the current tenant.
Behavior:
- Returns a list of all countries
- Returns
404if no countries exist
Authorization:
- Requires Bearer Token
GET
/api/v1/Country/GetCountryByCountryCode/{code}
Returns a single country by its unique country code.
Behavior:
- Looks up a country by
CountryCode - Returns
404if no country matches the provided code
Authorization:
- Requires Bearer Token
POST
/api/v1/Country/AddNewCountry
Creates a new country.
Request body:
CountryCode(string, required)CountryName(string, required)
Behavior:
- Validation is handled in the service layer
CountryCodemust be unique- Successful creation writes an audit log entry
Errors:
- Returns
400if validation - or country code already exists
Authorization:
- Requires Bearer Token
PUT
/api/v1/Country/UpdateCountry
Updates an existing country.
Request body:
CountryCode(string, required)CountryName(string, required)
Behavior:
- Partial updates are not supported
- Successful update writes an audit log entry
Errors:
- Returns
400if validation - or country does not exist
Authorization:
- Requires Bearer Token
DELETE
/api/v1/Country/DeleteCountryByCountryCode/{code}
Deletes a country by its country code.
Behavior:
- Performs a hard delete
- Record is permanently removed from the database
- Successful deletion writes an audit log entry
Errors:
- Returns
400if country does not exist or deletion -
Authorization:
- Requires Bearer Token
Notes
- Validation is enforced in the service layer, not via model attributes
- Country codes are expected to be unique
- Deleting a country does not cascade changes to other modules
- All state-changing operations are audited
- Internal errors are logged but not exposed to clients