π API Documentation - Endpoints
This section provides a detailed overview of the API endpoints used in the Angular Frontend Application. The services in the application define methods for interacting with external APIs to handle operations like orders, payments, staff management, and brand profiles. Below is a structured documentation of the key services and their respective endpoints.
π― RuleService (rule.service.ts)
The RuleService handles rules related to states, products, and zip codes. It provides methods for CRUD operations on these rules.
π οΈ Methods and Endpoints
| Method | Endpoint | Description |
|---|---|---|
addStateRule |
/rule/state-rule |
Adds a new state rule. |
addZipRule |
/rule/zip-rule |
Adds a new zip rule. |
addProductRule |
/rule/product-rule |
Adds a new product rule. |
getRuleList |
/rule/get-rules |
Retrieves a list of all rules. |
updateState |
/rule/state-rule/update |
Updates an existing state rule. |
deleteStateRule |
/rule/state-rule/remove?id={id} |
Deletes a state rule by its ID. |
deleteProductRule |
/rule/product-rule/remove?id={id} |
Deletes a product rule by its ID. |
updateProductRule |
/rule/product-rule/update |
Updates an existing product rule. |
getProductRules |
/rule/product-rules |
Fetches all product rules. |
getStateRules |
/rule/state-rules |
Fetches all state rules. |
π― HelperService (helper.service.ts)
The HelperService facilitates interaction with various entities like locations, states, products, and businesses.
π οΈ Methods and Endpoints
| Method | Endpoint | Description |
|---|---|---|
getLocations |
/locations |
Fetches a list of all locations. |
getAllStates |
/states/all |
Retrieves all states. |
getFilteredLocations |
/rule/available-locations?stateId={stateId}&productId={productId} |
Fetches locations filtered by state and product IDs. |
getProductsForSpecificLocation |
/rule/available-products?locationId={locationId} |
Retrieves products available for a specific location. |
getStatesForSpecificProductAndLocation |
/rule/available-states?locationId={locationId}&productIds={productIds} |
Retrieves states based on product and location IDs. |
getFilteredLocationsForProductRule |
/rule/available-locations2?productId={productId} |
Fetches filtered locations for a product rule. |
addTracking |
/add-tracking |
Adds tracking information. |
addBusiness |
/stripe/create-account |
Adds a new business account. |
updateBusiness |
/account/edit |
Updates an existing business account. |
saveRatings |
/public/brand/rate-retailer |
Saves ratings for a retailer. |
π― BrandsService (brands.service.ts)
The BrandsService manages operations related to brand profiles and commissions.
π οΈ Methods and Endpoints
| Method | Endpoint | Description |
|---|---|---|
getFulfillments |
/public/brand/all?pageSize={pageSize}&page={pageNo}&retailer={retailer}&brandName={brandName}&createdDate={createdDate} |
Fetches fulfillments for brands. |
updateCommision |
/public/brand/handle-commission |
Updates commission details for a brand. |
updateBrand |
/public/brand/update-details |
Updates brand details. |
π Example Code Snippet
Hereβs an example of how to use the RuleService to add a new state rule:
import { RuleService } from './services/rule.service';
constructor(private ruleService: RuleService) {}
addNewStateRule() {
const stateRule = {
states: ['California', 'Texas'],
locationId: '123',
products: ['Product1', 'Product2'],
code: 'ST123',
};
this.ruleService.addStateRule(stateRule).subscribe(
(response) => {
console.log('State Rule Added Successfully:', response);
},
(error) => {
console.error('Error Adding State Rule:', error);
}
);
}
π Highlights
- Dynamic Interaction: These services facilitate seamless API communication to manage orders, payments, and other operations.
- Reusability: The modular structure ensures reusable methods across the application.
- Error Handling: Each method includes error handling for robust API interactions.
Feel free to explore the services for more functionality and extend them as per your applicationβs requirements! π