openapi: 3.0.0 info: title: API Documentation description: Complete documentation of the API for managing products, categories, brands, stocks, and stores. servers: - url: https://dev-lemouto231.users.info.unicaen.fr/R112/2annee/S4/SAE401/API/api.php description: API Type REST for TO WHEELS (SAE401) paths: /S4/SAE401/products: get: summary: Retrieve all products description: Returns a list of all available products. responses: '200': description: List of products successfully retrieved. content: application/json: schema: type: array items: type: object properties: product_id: type: integer description: The unique identifier of the product. example: 1 product_name: type: string description: The name of the product. example: "Product A" list_price: type: number description: The price of the product. example: 99.99 category_id: type: integer description: The category identifier. example: 2 /S4/SAE401/product/{productId}: get: summary: Retrieve a product by ID description: Returns the details of a specific product. parameters: - name: productId in: path required: true description: The unique identifier of the product. schema: type: integer example: 1 responses: '200': description: Product successfully retrieved. content: application/json: schema: type: object properties: product_id: type: integer description: The unique identifier of the product. example: 1 product_name: type: string description: The name of the product. example: "Product A" list_price: type: number description: The price of the product. example: 99.99 category_id: type: integer description: The category identifier. example: 2 '404': description: Product not found. content: application/json: schema: type: object properties: error: type: string example: "Product not found." /S4/SAE401/categories: get: summary: Retrieve all categories description: Returns a list of all available categories. responses: '200': description: List of categories successfully retrieved. content: application/json: schema: type: array items: type: object properties: category_id: type: integer description: The unique identifier of the category. example: 1 category_name: type: string description: The name of the category. example: "Electronics" /S4/SAE401/category/{categoryId}: get: summary: Retrieve a category by ID description: Returns the details of a specific category. parameters: - name: categoryId in: path required: true description: The unique identifier of the category. schema: type: integer example: 1 responses: '200': description: Category successfully retrieved. content: application/json: schema: type: object properties: category_id: type: integer description: The unique identifier of the category. example: 1 category_name: type: string description: The name of the category. example: "Electronics" '404': description: Category not found. content: application/json: schema: type: object properties: error: type: string example: "Category not found." /S4/SAE401/brands: get: summary: Retrieve all brands description: Returns a list of all available brands. responses: '200': description: List of brands successfully retrieved. content: application/json: schema: type: array items: type: object properties: brand_id: type: integer description: The unique identifier of the brand. example: 1 brand_name: type: string description: The name of the brand. example: "Brand A" /S4/SAE401/brand/{brandId}: get: summary: Retrieve a brand by ID description: Returns the details of a specific brand. parameters: - name: brandId in: path required: true description: The unique identifier of the brand. schema: type: integer example: 1 responses: '200': description: Brand successfully retrieved. content: application/json: schema: type: object properties: brand_id: type: integer description: The unique identifier of the brand. example: 1 brand_name: type: string description: The name of the brand. example: "Brand A" '404': description: Brand not found. content: application/json: schema: type: object properties: error: type: string example: "Brand not found." /S4/SAE401/stores: get: summary: Retrieve all stores description: Returns a list of all available stores. responses: '200': description: List of stores successfully retrieved. content: application/json: schema: type: array items: type: object properties: store_id: type: integer description: The unique identifier of the store. example: 1 store_name: type: string description: The name of the store. example: "Store A" /S4/SAE401/store/{storeId}: get: summary: Retrieve a store by ID description: Returns the details of a specific store. parameters: - name: storeId in: path required: true description: The unique identifier of the store. schema: type: integer example: 1 responses: '200': description: Store successfully retrieved. content: application/json: schema: type: object properties: store_id: type: integer description: The unique identifier of the store. example: 1 store_name: type: string description: The name of the store. example: "Store A" '404': description: Store not found. content: application/json: schema: type: object properties: error: type: string example: "Store not found." /S4/SAE401/stocks: get: summary: Retrieve all stocks description: Returns a list of all available stocks. responses: '200': description: List of stocks successfully retrieved. content: application/json: schema: type: array items: type: object properties: product_id: type: integer description: The unique identifier of the product. example: 101 quantity: type: integer description: Quantity in stock. example: 50 store_id: type: integer description: The unique identifier of the store. example: 1 /stocks/{storeId}: get: summary: Retrieve stocks for a store description: Returns the list of stocks for a specific store based on its `storeId`. parameters: - name: storeId in: path required: true description: The unique identifier of the store. schema: type: integer example: 1 responses: '200': description: List of stocks successfully retrieved. content: application/json: schema: type: array items: type: object properties: product_id: type: integer description: The unique identifier of the product. example: 101 quantity: type: integer description: Quantity in stock. example: 50 store_id: type: integer description: The unique identifier of the store. example: 1 '400': description: Invalid request. '404': description: No stocks found for the specified store. /S4/SAE401/stock/{stockId}: get: summary: Retrieve a stock by ID description: Returns the details of a specific stock. parameters: - name: stockId in: path required: true description: The unique identifier of the stock. schema: type: integer example: 1 responses: '200': description: Stock successfully retrieved. content: application/json: schema: type: object properties: product_id: type: integer description: The unique identifier of the product. example: 101 quantity: type: integer description: Quantity in stock. example: 50 store_id: type: integer description: The unique identifier of the store. example: 1 '404': description: Stock not found. content: application/json: schema: type: object properties: error: type: string example: "Stock not found."