### Initialize and Render Guide Source: https://github.com/testsmith-io/practice-software-testing/blob/main/sprint5/UI/src/assets/testing-guide.html Initializes the testing guide by loading the current step, progress, and rendering the current feature. Updates progress and navigation accordingly. ```javascript function initializeGuide() { loadCurrentStep(); loadProgress(); renderCurrentFeature(); updateProgress(); updateNavigation(); } ``` -------------------------------- ### Initialize Guide UI Source: https://github.com/testsmith-io/practice-software-testing/blob/main/sprint5/UI/src/assets/testing-guide.html Initializes the guide UI by checking completion status and updating elements. This code runs on DOMContentLoaded. ```javascript progress.completed.forEach((isCompleted, index) => { const checkbox = document.getElementById("complete-${index}"); if (checkbox && isCompleted) { checkbox.checked = true; document.getElementById("feature-${index}").classList.add('completed'); } }); } } // Initialize on load document.addEventListener('DOMContentLoaded', () => { initializeGuide(); }); ``` -------------------------------- ### Setup Two-Factor Authentication Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Initiates TOTP setup for the authenticated user. Returns a secret and QR code URL. ```bash curl -X POST "https://api.practicesoftwaretesting.com/totp/setup" \ -H "Authorization: Bearer " # Response (200 OK): { "secret": "JBSWY3DPEHPK3PXP", "qrCodeUrl": "otpauth://totp/PracticeSoftwareTesting:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=PracticeSoftwareTesting" } # Error Response (400 Bad Request) - Already enabled: { "error": "TOTP already enabled" } ``` -------------------------------- ### Start Docker Services for Production Source: https://github.com/testsmith-io/practice-software-testing/blob/main/docs/getting-started.md Starts Docker services using prebuilt images for production environments. Ensures missing images are pulled before starting. ```bash docker compose -f docker-compose.prod.yml up --pull missing -d ``` -------------------------------- ### POST /totp/setup Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Initiates TOTP setup for the authenticated user. ```APIDOC ## POST /totp/setup ### Description Initiates TOTP (Time-based One-Time Password) setup for the authenticated user. Returns a secret and QR code URL for authenticator apps. ### Method POST ### Endpoint https://api.practicesoftwaretesting.com/totp/setup ### Response #### Success Response (200) - **secret** (string) - TOTP secret key - **qrCodeUrl** (string) - URL for the QR code #### Response Example { "secret": "JBSWY3DPEHPK3PXP", "qrCodeUrl": "otpauth://totp/PracticeSoftwareTesting:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=PracticeSoftwareTesting" } ``` -------------------------------- ### Start Docker Services for Local Development Source: https://github.com/testsmith-io/practice-software-testing/blob/main/docs/getting-started.md Starts all Docker services with source code mounted for live changes. Includes optional services like mailcatcher and phpmyadmin. ```bash docker compose up -d ``` -------------------------------- ### Start Minimal Docker Services Source: https://github.com/testsmith-io/practice-software-testing/blob/main/docs/getting-started.md Starts Docker services using only the main docker-compose.yml file, excluding optional services like mailcatcher, phpmyadmin, and cron. ```bash docker compose -f docker-compose.yml up -d ``` -------------------------------- ### Get Completion Summary Source: https://github.com/testsmith-io/practice-software-testing/blob/main/sprint5/UI/src/assets/testing-guide.html Generates a summary string indicating the completion status of the testing guide, including the number of features tested and the percentage complete. Displays different messages based on completion level. ```javascript function getCompletionSummary() { const completed = features.filter((_, index) => isCompleted(index)).length; const total = features.length; const percentage = Math.round((completed / total) * 100); if (completed === total) { return `
๐ŸŽ‰ All features tested! (${completed}/${total})
`; } else if (completed > 0) { return `
Progress: ${completed}/${total} features tested (${percentage}%)
`; } else { return `
Start testing your first feature to track progress
`; } } ``` -------------------------------- ### Start Docker Development Environment Source: https://github.com/testsmith-io/practice-software-testing/blob/main/README.md Commands to initialize the application containers with varying levels of service inclusion. ```bash docker compose up -d ``` ```bash docker compose -f docker-compose.yml up -d ``` ```bash docker compose -f docker-compose.prod.yml up --pull missing -d ``` -------------------------------- ### Clone Repository and Initialize Project Source: https://github.com/testsmith-io/practice-software-testing/blob/main/docs/getting-started.md Clone the repository, set the sprint version in the .env file, and start all Docker services. This includes initializing the database with fresh migrations and seeds. ```bash # 1. Clone the repository git clone https://github.com/testsmith-io/practice-software-testing.git cd practice-software-testing # 2. Set the sprint version (default: sprint5) echo "SPRINT=sprint5" > .env # 3. Start all services docker compose up -d # 4. Initialize the database (wait ~30s for MariaDB to be ready) docker compose exec laravel-api php artisan migrate:fresh --seed ``` -------------------------------- ### Manage Pact Mock Service Source: https://github.com/testsmith-io/practice-software-testing/blob/main/README.md Commands to start and stop the Pact mock service for contract testing. ```bash pact-mock-service start --host localhost --port 7203 --consumer AnyConsumer --provider ProductAPI --pact-dir ./pacts --log ./storage/logs/pact.log ``` ```bash pact-mock-service stop --port 7203 ``` -------------------------------- ### Load Current Step from Local Storage Source: https://github.com/testsmith-io/practice-software-testing/blob/main/sprint5/UI/src/assets/testing-guide.html Loads the previously saved current step index from local storage when the guide is initialized. ```javascript function loadCurrentStep() { const saved = localStorage.getItem('testing-guide-current-step'); if (saved) { currentStep = parseInt(saved, 10) || 0; } } ``` -------------------------------- ### Pact Contract Testing Commands Source: https://github.com/testsmith-io/practice-software-testing/blob/main/docs/getting-started.md Commands to start and stop the Pact mock service for contract testing. ```bash # Start pact mock service pact-mock-service start --host localhost --port 7203 \ --consumer AnyConsumer --provider ProductAPI \ --pact-dir ./pacts --log ./storage/logs/pact.log # Stop pact mock service pact-mock-service stop --port 7203 ``` -------------------------------- ### GET /favorites Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves all products favorited by the authenticated user. ```APIDOC ## GET /favorites ### Description Retrieves all products favorited by the authenticated user. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/favorites ### Response #### Success Response (200) - **data** (array) - List of favorite objects #### Response Example [ { "id": "01HHJC7RERZ0M3VDGS6X9HM66G", "product_id": "01HHJC7RERZ0M3VDGS6X9HM33A", "product": { "id": "01HHJC7RERZ0M3VDGS6X9HM33A", "name": "Combination Pliers", "price": 14.15 } } ] ``` -------------------------------- ### Products - Get Single Product Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves detailed information about a specific product. ```APIDOC ## Get Single Product ### Description Retrieves detailed information for a specific product using its ID, including brand, category, and image data. ### Method GET ### Endpoint /products/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the product. ### Response #### Success Response (200 OK) - **id** (string) - Unique identifier for the product. - **name** (string) - Name of the product. - **description** (string) - Description of the product. - **price** (number) - Price of the product. - **is_location_offer** (boolean) - Indicates if the product is a location offer. - **is_rental** (boolean) - Indicates if the product is available for rent. - **in_stock** (boolean) - Indicates if the product is in stock. - **co2_rating** (string) - CO2 rating of the product. - **is_eco_friendly** (boolean) - Indicates if the product is eco-friendly. - **brand** (object) - Brand information. - **id** (string) - Brand ID. - **name** (string) - Brand name. - **category** (object) - Category information. - **id** (string) - Category ID. - **name** (string) - Category name. - **slug** (string) - Category slug. - **product_image** (object) - Product image information. - **id** (string) - Image ID. - **by_name** (string) - Name of the image uploader. - **by_url** (string) - URL of the image uploader. - **source_name** (string) - Source of the image. - **source_url** (string) - URL of the image source. - **file_name** (string) - Image file name. - **title** (string) - Title of the image. ### Response Example ```json { "id": "01HHJC7RERZ0M3VDGS6X9HM33A", "name": "Combination Pliers", "description": "High-quality combination pliers for multiple uses including gripping, bending, and cutting wire.", "price": 14.15, "is_location_offer": false, "is_rental": false, "in_stock": true, "co2_rating": "B", "is_eco_friendly": true, "brand": { "id": "01HHJC7RERZ0M3VDGS6X9HM33B", "name": "ForgeFlex Tools" }, "category": { "id": "01HHJC7RERZ0M3VDGS6X9HM33C", "name": "Pliers", "slug": "pliers" }, "product_image": { "id": "01HHJC7RERZ0M3VDGS6X9HM33D", "by_name": "Helinton Fantin", "by_url": "https://unsplash.com/@fantin", "source_name": "unsplash", "source_url": "https://unsplash.com/photos/W8BNwvOvW4M", "file_name": "pliers01.avif", "title": "Pliers" } } ``` ``` -------------------------------- ### POST /totp/verify Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Verifies a TOTP code to complete 2FA setup. ```APIDOC ## POST /totp/verify ### Description Verifies a TOTP code to complete 2FA setup. After successful verification, TOTP is enabled for the account. ### Method POST ### Endpoint https://api.practicesoftwaretesting.com/totp/verify ### Parameters #### Request Body - **totp** (string) - Required - The TOTP code to verify ### Response #### Success Response (200) - **message** (string) - Success message #### Response Example { "message": "TOTP enabled successfully" } ``` -------------------------------- ### Navigate to Previous Step Source: https://github.com/testsmith-io/practice-software-testing/blob/main/sprint5/UI/src/assets/testing-guide.html Navigates the guide to the previous step if not already on the first step. Saves the current step and updates the UI. ```javascript function previousStep() { if (currentStep > 0) { currentStep--; saveCurrentStep(); renderCurrentFeature(); updateProgress(); updateNavigation(); } } ``` -------------------------------- ### Get Users List Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves a list of users with pagination. Requires authentication. ```json { "current_page": 1, "data": [ { "id": "01HHJC7RERZ0M3VDGS6X9HM11A", "first_name": "John", "last_name": "Doe", "email": "admin@practicesoftwaretesting.com" }, { "id": "01HHJC7RERZ0M3VDGS6X9HM22B", "first_name": "Jane", "last_name": "Doe", "email": "customer@practicesoftwaretesting.com" } ], "total": 2 } ``` -------------------------------- ### Navigate to Next Step Source: https://github.com/testsmith-io/practice-software-testing/blob/main/sprint5/UI/src/assets/testing-guide.html Advances the guide to the next step if not already on the last step. Saves the current step and updates the UI. ```javascript function nextStep() { if (currentStep < features.length - 1) { currentStep++; saveCurrentStep(); renderCurrentFeature(); updateProgress(); updateNavigation(); } } ``` -------------------------------- ### Get Customers by Country Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves customer count by country. Requires an admin access token. ```bash curl -X GET "https://api.practicesoftwaretesting.com/reports/customers-by-country" \ -H "Authorization: Bearer " # Response (200 OK): [ { "country": "United States", "amount": 1234 }, { "country": "The Netherlands", "amount": 567 } ] ``` -------------------------------- ### Get Cart Contents Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Fetches the current state of a shopping cart, including items and pricing. ```bash curl -X GET "https://api.practicesoftwaretesting.com/carts/01HHJC7RERZ0M3VDGS6X9HM33E" ``` -------------------------------- ### Get Single Product Details Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves detailed information for a specific product using its ID. Includes product details, brand, category, and image information. ```bash curl -X GET "https://api.practicesoftwaretesting.com/products/01HHJC7RERZ0M3VDGS6X9HM33A" ``` -------------------------------- ### Get OAuth URL Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Initiates OAuth login flow for Google or GitHub. Redirects the user to the provider's login page. ```bash # Get Google OAuth URL curl -X GET "https://api.practicesoftwaretesting.com/auth/social-login?provider=google" # Get GitHub OAuth URL curl -X GET "https://api.practicesoftwaretesting.com/auth/social-login?provider=github" # Response: Redirect to OAuth provider ``` -------------------------------- ### Get Top 10 Purchased Products (Admin) Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves a list of the top 10 most purchased products. This endpoint requires admin privileges and an admin access token. ```bash curl -X GET "https://api.practicesoftwaretesting.com/reports/top10-purchased-products" \ -H "Authorization: Bearer " ``` -------------------------------- ### Verify and Enable TOTP Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Verifies a TOTP code to complete 2FA setup. Requires a valid TOTP code in the request body. ```bash curl -X POST "https://api.practicesoftwaretesting.com/totp/verify" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "totp": "123456" }' # Response (200 OK): { "message": "TOTP enabled successfully" } # Error Response (400 Bad Request): { "error": "Invalid TOTP" } ``` -------------------------------- ### Create Product Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Use this endpoint to create a new product. Requires authentication and typically admin privileges. The request body must include product details like name, description, price, and category/brand IDs. ```bash curl -X POST "https://api.practicesoftwaretesting.com/products" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "name": "Professional Hammer", "description": "Heavy-duty hammer for professional use", "price": 24.99, "category_id": "01HHJC7RERZ0M3VDGS6X9HM33C", "brand_id": "01HHJC7RERZ0M3VDGS6X9HM33B", "product_image_id": "01HHJC7RERZ0M3VDGS6X9HM33D", "is_location_offer": false, "is_rental": false }' ``` -------------------------------- ### GET /messages Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves contact messages. ```APIDOC ## GET /messages ### Description Retrieves contact messages. Admin sees all messages; users see only their own. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/messages ### Response #### Success Response (200) - **current_page** (integer) - Current page number - **data** (array) - List of messages - **total** (integer) - Total count of messages #### Response Example { "current_page": 1, "data": [ { "id": "01HHJC7RERZ0M3VDGS6X9HM77H", "subject": "Product Inquiry", "message": "I have a question about the combination pliers.", "status": "NEW", "created_at": "2024-01-15 10:30:00" } ], "total": 1 } ``` -------------------------------- ### Render Current Feature - Introduction Source: https://github.com/testsmith-io/practice-software-testing/blob/main/sprint5/UI/src/assets/testing-guide.html Renders the introduction section for the current feature. Includes title, content, and a 'Mark as read' checkbox. ```javascript function renderCurrentFeature() { const container = document.getElementById('featuresList'); const feature = features[currentStep]; if (feature.isIntroduction) { container.innerHTML = `

${currentStep + 1} ${feature.title}

${feature.content}
${getCompletionSummary()}
`; } else { container.innerHTML = `

${currentStep + 1} ${feature.title}

${feature.userStory}

โœ… Acceptance Criteria

    ${feature.acceptanceCriteria.map(criteria => `
  • ${criteria}
  • `).join('')}

๐Ÿงช Testing Guidance

    ${feature.testingGuidance.map(guidance => `
  • ${guidance}
  • `).join('')}

๐Ÿ”ง Testing Techniques

    ${feature.techniques.map(technique => `
  • ${technique}
  • `).join('')}
${getCompletionSummary()}
`; } } ``` -------------------------------- ### Create Brand Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Registers a new product brand in the system. ```bash curl -X POST "https://api.practicesoftwaretesting.com/brands" \ -H "Content-Type: application/json" \ -d '{ "name": "ProGrade Tools", "slug": "prograde-tools" }' ``` -------------------------------- ### GET /users Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves all users with pagination. Requires admin role. ```APIDOC ## GET /users ### Description Retrieves all users with pagination. Requires admin role. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/users ### Parameters #### Query Parameters - **page** (integer) - Optional - Page number for pagination ### Response #### Success Response (200) - **current_page** (integer) - Current page number - **data** (array) - List of users - **total** (integer) - Total number of users #### Response Example { "current_page": 1, "data": [], "total": 4 } ``` -------------------------------- ### GET /reports/top10-purchased-products Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves the top 10 most purchased products (Admin only). ```APIDOC ## GET /reports/top10-purchased-products ### Description Retrieves the top 10 most purchased products. Requires admin role. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/reports/top10-purchased-products ### Response #### Success Response (200) - **name** (string) - Product name - **count** (integer) - Purchase count #### Response Example [ { "name": "Combination Pliers", "count": 156 }, { "name": "Claw Hammer", "count": 142 } ] ``` -------------------------------- ### Products - Create Product Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Creates a new product. Requires authentication and typically admin privileges. ```APIDOC ## POST /api/products ### Description Creates a new product. Requires authentication and typically admin privileges. ### Method POST ### Endpoint https://api.practicesoftwaretesting.com/products ### Request Body - **name** (string) - Required - The name of the product. - **description** (string) - Optional - A detailed description of the product. - **price** (number) - Required - The price of the product. - **category_id** (string) - Required - The ID of the product's category. - **brand_id** (string) - Required - The ID of the product's brand. - **product_image_id** (string) - Optional - The ID of the product's image. - **is_location_offer** (boolean) - Optional - Indicates if the product is a location offer. - **is_rental** (boolean) - Optional - Indicates if the product is available for rent. ### Request Example ```json { "name": "Professional Hammer", "description": "Heavy-duty hammer for professional use", "price": 24.99, "category_id": "01HHJC7RERZ0M3VDGS6X9HM33C", "brand_id": "01HHJC7RERZ0M3VDGS6X9HM33B", "product_image_id": "01HHJC7RERZ0M3VDGS6X9HM33D", "is_location_offer": false, "is_rental": false } ``` ### Response #### Success Response (201 Created) - **id** (string) - The unique identifier of the created product. - **name** (string) - The name of the product. - **description** (string) - The description of the product. - **price** (number) - The price of the product. - **is_location_offer** (boolean) - Indicates if the product is a location offer. - **is_rental** (boolean) - Indicates if the product is available for rent. - **in_stock** (boolean) - Indicates if the product is in stock. - **brand** (object) - Information about the product's brand. - **category** (object) - Information about the product's category. #### Response Example ```json { "id": "01HHJC7RERZ0M3VDGS6X9HM33A", "name": "Professional Hammer", "description": "Heavy-duty hammer for professional use", "price": 24.99, "is_location_offer": false, "is_rental": false, "in_stock": true, "brand": { "id": "01HHJC7RERZ0M3VDGS6X9HM33B", "name": "ForgeFlex Tools" }, "category": { "id": "01HHJC7RERZ0M3VDGS6X9HM33C", "name": "Hammer", "slug": "hammer" } } ``` ``` -------------------------------- ### GET /users/me Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves the profile information of the currently authenticated user. ```APIDOC ## GET /users/me ### Description Retrieves the profile information of the currently authenticated user. Requires a valid Bearer token. ### Method GET ### Endpoint /users/me ### Response #### Success Response (200) - **id** (string) - **first_name** (string) - **last_name** (string) - **email** (string) - **dob** (string) - **phone** (string) - **address** (object) - **totp_enabled** (boolean) - **created_at** (string) ### Response Example { "id": "01HHJC7RERZ0M3VDGS6X9HM33A", "first_name": "Jane", "last_name": "Doe", "email": "customer@practicesoftwaretesting.com", "dob": "1970-01-01", "phone": "0987654321", "address": { "street": "Street 1", "city": "City", "state": "State", "country": "Country", "postal_code": "1234AA" }, "totp_enabled": false, "created_at": "2024-01-01 00:00:00" } ``` -------------------------------- ### Create Cart Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Initializes a new shopping cart and returns a unique identifier. ```bash curl -X POST "https://api.practicesoftwaretesting.com/carts" \ -H "Content-Type: application/json" \ -d '{}' ``` -------------------------------- ### GET /reports/total-sales-per-country Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves total sales broken down by billing country (Admin only). ```APIDOC ## GET /reports/total-sales-per-country ### Description Retrieves total sales broken down by billing country. Requires admin role. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/reports/total-sales-per-country ### Response #### Success Response (200) - **billing_country** (string) - Country name - **total_sales** (string) - Total sales amount #### Response Example [ { "billing_country": "United States", "total_sales": "15234.50" }, { "billing_country": "The Netherlands", "total_sales": "8721.30" } ] ``` -------------------------------- ### Search Products by Name Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Searches for products by name. Returns paginated results based on the query parameter 'q'. ```bash curl -X GET "https://api.practicesoftwaretesting.com/products/search?q=pliers" ``` -------------------------------- ### GET /invoices/{id}/download-pdf-status Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Checks the status of PDF generation for an invoice. ```APIDOC ## GET /invoices/{id}/download-pdf-status ### Description Checks the status of PDF generation for an invoice. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/invoices/{id}/download-pdf-status ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the invoice. ### Response #### Success Response (200 OK) - **status** (string) - The status of the PDF generation. Possible values: NOT_INITIATED, INITIATED, IN_PROGRESS, COMPLETED. #### Response Example ```json { "status": "COMPLETED" } ``` ``` -------------------------------- ### GET /invoices/search Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Searches invoices by invoice number, billing street, or status. ```APIDOC ## GET /invoices/search ### Description Searches invoices by invoice number, billing street, or status. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/invoices/search ### Parameters #### Query Parameters - **q** (string) - Required - The search query string. Can be an invoice number, billing street, or status. ### Response #### Success Response (200 OK) - **current_page** (integer) - The current page number of the results. - **data** (array) - An array of invoice objects matching the search query. - **id** (string) - The unique identifier for the invoice. - **invoice_number** (string) - The invoice number. - **status** (string) - The current status of the invoice. - **total** (integer) - The total number of invoices found. #### Response Example ```json { "current_page": 1, "data": [ { "id": "01HHJC7RERZ0M3VDGS6X9HM55F", "invoice_number": "INV-2024-00001", "status": "AWAITING_FULFILLMENT" } ], "total": 1 } ``` ``` -------------------------------- ### Database Management Commands Source: https://github.com/testsmith-io/practice-software-testing/blob/main/docs/getting-started.md Provides commands for full database resets, running pending migrations, and seeding the database. ```bash # Full reset (drop all tables, re-migrate, re-seed) docker compose exec laravel-api php artisan migrate:fresh --seed # Run pending migrations only docker compose exec laravel-api php artisan migrate # Seed database (without resetting) docker compose exec laravel-api php artisan db:seed ``` -------------------------------- ### Products - Get Related Products Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves products that are related to a specific product. ```APIDOC ## Get Related Products ### Description Retrieves a list of products that are related to a given product, typically based on category. ### Method GET ### Endpoint /products/{id}/related ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the product for which to find related items. ### Response #### Success Response (200 OK) - An array of related product objects. - **id** (string) - Unique identifier for the related product. - **name** (string) - Name of the related product. - **price** (number) - Price of the related product. - **is_location_offer** (boolean) - Indicates if the product is a location offer. - **is_rental** (boolean) - Indicates if the product is available for rent. - **in_stock** (boolean) - Indicates if the product is in stock. ### Response Example ```json [ { "id": "01HHJC7RERZ0M3VDGS6X9HM44B", "name": "Long Nose Pliers", "price": 12.99, "is_location_offer": false, "is_rental": false, "in_stock": true }, { "id": "01HHJC7RERZ0M3VDGS6X9HM55C", "name": "Slip Joint Pliers", "price": 9.99, "is_location_offer": false, "is_rental": false, "in_stock": true } ] ``` ``` -------------------------------- ### Get API Status Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Checks the API status and version information. No authentication required. ```bash curl -X GET "https://api.practicesoftwaretesting.com/status" ``` ```json { "version": "5.0.0", "environment": "production", "app_name": "Practice Software Testing API" } ``` -------------------------------- ### GET /reports/total-sales-of-years Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves total sales for a specified number of years. Requires admin role. ```APIDOC ## GET /reports/total-sales-of-years ### Description Retrieves total sales for a specified number of years. Requires admin role. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/reports/total-sales-of-years ### Parameters #### Query Parameters - **years** (integer) - Required - Number of years to retrieve data for ### Response #### Success Response (200) - **year** (integer) - The year - **total** (number) - Total sales for the year #### Response Example [ { "year": 2022, "total": 45678.90 } ] ``` -------------------------------- ### List All Users Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves all users with pagination. Requires an admin access token. ```bash curl -X GET "https://api.practicesoftwaretesting.com/users?page=1" \ -H "Authorization: Bearer " # Response (200 OK): { "current_page": 1, "data": [ { "id": "01HHJC7RERZ0M3VDGS6X9HM11A", "first_name": "John", "last_name": "Doe", "email": "admin@practicesoftwaretesting.com", "role": "admin", "enabled": true, "totp_enabled": false }, { "id": "01HHJC7RERZ0M3VDGS6X9HM22B", "first_name": "Jane", "last_name": "Doe", "email": "customer@practicesoftwaretesting.com", "role": "user", "enabled": true, "totp_enabled": false } ], "total": 4 } ``` -------------------------------- ### POST /users/register Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Creates a new user account with required profile information. ```APIDOC ## POST /users/register ### Description Creates a new user account. Password must include uppercase, lowercase, numbers, and symbols. Users must be between 18 and 75 years old. ### Method POST ### Endpoint /users/register ### Request Body - **first_name** (string) - Required - **last_name** (string) - Required - **email** (string) - Required - **password** (string) - Required - **dob** (string) - Required - Date of birth (YYYY-MM-DD) - **phone** (string) - Required - **address** (object) - Required - Contains street, city, state, country, postal_code ### Response #### Success Response (201) - **id** (string) - User ID - **first_name** (string) - **last_name** (string) - **email** (string) - **dob** (string) - **phone** (string) - **address** (object) - **created_at** (string) ### Response Example { "id": "01HHJC7RERZ0M3VDGS6X9HM33A", "first_name": "Test", "last_name": "User", "email": "testuser@example.com", "dob": "1990-05-15", "phone": "555-123-4567", "address": { "street": "123 Main Street", "city": "New York", "state": "NY", "country": "United States", "postal_code": "10001" }, "created_at": "2024-01-15 10:30:00" } ``` -------------------------------- ### GET /reports/top10-best-selling-categories Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves the top 10 categories by total revenue. Requires admin role. ```APIDOC ## GET /reports/top10-best-selling-categories ### Description Retrieves the top 10 categories by total revenue. Requires admin role. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/reports/top10-best-selling-categories ### Response #### Success Response (200) - **category_name** (string) - Name of the category - **total_earned** (string) - Total revenue earned #### Response Example [ { "category_name": "Hand Tools", "total_earned": "45678.90" } ] ``` -------------------------------- ### List All Products Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves a paginated list of products. Supports filtering by category, brand, price range, rental status, and sorting options. Use query parameters to specify filters. ```bash # Get all products (paginated) curl -X GET "https://api.practicesoftwaretesting.com/products" ``` ```bash # Filter by category curl -X GET "https://api.practicesoftwaretesting.com/products?by_category=01HHJC7RERZ0M3VDGS6X9HM33A" ``` ```bash # Filter by brand curl -X GET "https://api.practicesoftwaretesting.com/products?by_brand=01HHJC7RERZ0M3VDGS6X9HM33B" ``` ```bash # Filter by price range (between minimum and maximum) curl -X GET "https://api.practicesoftwaretesting.com/products?between=price,10,50" ``` ```bash # Filter rental products curl -X GET "https://api.practicesoftwaretesting.com/products?is_rental=1" ``` ```bash # Sort by price ascending curl -X GET "https://api.practicesoftwaretesting.com/products?sort=price,asc" ``` ```bash # Sort by name descending curl -X GET "https://api.practicesoftwaretesting.com/products?sort=name,desc" ``` ```bash # Combine filters with pagination curl -X GET "https://api.practicesoftwaretesting.com/products?by_category=01HHJC7RERZ0M3VDGS6X9HM33A&between=price,5,100&sort=price,asc&page=2" ``` -------------------------------- ### GET /invoices/{id}/download-pdf Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Downloads a PDF version of the invoice. The PDF is generated asynchronously. ```APIDOC ## GET /invoices/{id}/download-pdf ### Description Downloads a PDF version of the invoice. The PDF is generated asynchronously. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/invoices/{id}/download-pdf ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the invoice. ### Notes It is recommended to first check the PDF generation status using `/invoices/{id}/download-pdf-status` before attempting to download. ``` -------------------------------- ### List All Brands Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves a list of all available product brands. This endpoint does not require authentication. ```bash curl -X GET "https://api.practicesoftwaretesting.com/brands" ``` -------------------------------- ### GET /invoices/{id} Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves detailed information about a specific invoice including line items. ```APIDOC ## GET /invoices/{id} ### Description Retrieves detailed information about a specific invoice including line items. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/invoices/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the invoice. ### Response #### Success Response (200 OK) - **id** (string) - The unique identifier for the invoice. - **invoice_number** (string) - The invoice number. - **invoice_date** (string) - The date the invoice was created. - **status** (string) - The current status of the invoice. - **billing_street** (string) - The billing street address. - **billing_city** (string) - The billing city. - **billing_state** (string) - The billing state. - **billing_country** (string) - The billing country. - **billing_postal_code** (string) - The billing postal code. - **total** (number) - The total amount of the invoice. - **invoice_lines** (array) - An array of invoice line items. - **product_id** (string) - The unique identifier for the product. - **product_name** (string) - The name of the product. - **quantity** (integer) - The quantity of the product. - **unit_price** (number) - The unit price of the product. #### Response Example ```json { "id": "01HHJC7RERZ0M3VDGS6X9HM55F", "invoice_number": "INV-2024-00001", "invoice_date": "2024-01-15", "status": "AWAITING_FULFILLMENT", "billing_street": "123 Main Street", "billing_city": "New York", "billing_state": "NY", "billing_country": "United States", "billing_postal_code": "10001", "total": 41.29, "invoice_lines": [ { "product_id": "01HHJC7RERZ0M3VDGS6X9HM33A", "product_name": "Combination Pliers", "quantity": 2, "unit_price": 14.15 }, { "product_id": "01HHJC7RERZ0M3VDGS6X9HM44B", "product_name": "Long Nose Pliers", "quantity": 1, "unit_price": 12.99 } ] } ``` ``` -------------------------------- ### Get Invoice Details Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves detailed information about a specific invoice, including its line items. ```bash curl -X GET "https://api.practicesoftwaretesting.com/invoices/01HHJC7RERZ0M3VDGS6X9HM55F" \ -H "Authorization: Bearer " ``` ```json { "id": "01HHJC7RERZ0M3VDGS6X9HM55F", "invoice_number": "INV-2024-00001", "invoice_date": "2024-01-15", "status": "AWAITING_FULFILLMENT", "billing_street": "123 Main Street", "billing_city": "New York", "billing_state": "NY", "billing_country": "United States", "billing_postal_code": "10001", "total": 41.29, "invoice_lines": [ { "product_id": "01HHJC7RERZ0M3VDGS6X9HM33A", "product_name": "Combination Pliers", "quantity": 2, "unit_price": 14.15 }, { "product_id": "01HHJC7RERZ0M3VDGS6X9HM44B", "product_name": "Long Nose Pliers", "quantity": 1, "unit_price": 12.99 } ] } ``` -------------------------------- ### Switch Sprints and Restart Services Source: https://github.com/testsmith-io/practice-software-testing/blob/main/docs/getting-started.md Update the SPRINT variable in the .env file to switch to a different sprint version, then restart the Docker containers and re-seed the database. ```bash # Edit .env to set the desired sprint echo "SPRINT=sprint4" > .env # Restart containers and re-seed docker compose up -d docker compose exec laravel-api php artisan migrate:fresh --seed ``` -------------------------------- ### Update Product Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Fully updates an existing product with all fields. Provide the product ID in the URL and the complete product object in the request body. Requires authentication. ```bash curl -X PUT "https://api.practicesoftwaretesting.com/products/01HHJC7RERZ0M3VDGS6X9HM33A" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{ "name": "Updated Combination Pliers", "description": "Updated description for combination pliers", "price": 15.99, "category_id": "01HHJC7RERZ0M3VDGS6X9HM33C", "brand_id": "01HHJC7RERZ0M3VDGS6X9HM33B", "product_image_id": "01HHJC7RERZ0M3VDGS6X9HM33D", "is_location_offer": true, "is_rental": false }' ``` -------------------------------- ### Categories - Get Category Tree Source: https://context7.com/testsmith-io/practice-software-testing/llms.txt Retrieves all categories with their nested subcategories in a hierarchical tree structure. ```APIDOC ## GET /api/categories/tree ### Description Retrieves all categories with their nested subcategories in a hierarchical tree structure. ### Method GET ### Endpoint https://api.practicesoftwaretesting.com/categories/tree ### Query Parameters - **by_category_slug** (string) - Optional - Filter categories by a parent category slug. ### Response #### Success Response (200 OK) - **id** (string) - The unique identifier of the category. - **name** (string) - The name of the category. - **slug** (string) - The slug of the category. - **sub_categories** (array) - An array of subcategories, each with the same structure. #### Response Example ```json [ { "id": "01HHJC7RERZ0M3VDGS6X9HM33C", "name": "Hand Tools", "slug": "hand-tools", "sub_categories": [ { "id": "01HHJC7RERZ0M3VDGS6X9HM44D", "name": "Pliers", "slug": "pliers", "sub_categories": [] }, { "id": "01HHJC7RERZ0M3VDGS6X9HM55E", "name": "Hammer", "slug": "hammer", "sub_categories": [] }, { "id": "01HHJC7RERZ0M3VDGS6X9HM66F", "name": "Screwdriver", "slug": "screwdriver", "sub_categories": [] } ] }, { "id": "01HHJC7RERZ0M3VDGS6X9HM77G", "name": "Power Tools", "slug": "power-tools", "sub_categories": [] } ] ``` ```