Add API endpoint documentation page#19
Conversation
Co-authored-by: ramesh2051 <95218310+ramesh2051@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new MVC “API Endpoint Guide” page under Home to centralize REST API documentation and make it reachable from the home page.
Changes:
- Added
Views/Home/ApiGuide.cshtmlto document API modules, endpoints, and response format examples. - Added
ApiGuide()action toHomeControllerto serve the new view. - Added an “API Guide” button to the home page hero section.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 15 comments.
| File | Description |
|---|---|
| Views/Home/Index.cshtml | Adds a new button linking users to the API Guide page. |
| Views/Home/ApiGuide.cshtml | New documentation page with module cards, endpoint tables, and quick links. |
| Controllers/HomeController.cs | Adds ApiGuide() action to render the new documentation view. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| </p> | ||
| <div class="alert alert-info"> | ||
| <strong>Base URL:</strong> <code>http://localhost:5145/api</code><br> | ||
| <strong>Swagger UI:</strong> <a href="/swagger" target="_blank">/swagger</a> - Interactive API testing |
There was a problem hiding this comment.
This link opens a new tab (target="_blank") but is missing rel="noopener noreferrer", which can allow the opened page to access window.opener. Add the appropriate rel attributes when using target="_blank".
| <strong>Swagger UI:</strong> <a href="/swagger" target="_blank">/swagger</a> - Interactive API testing | |
| <strong>Swagger UI:</strong> <a href="/swagger" target="_blank" rel="noopener noreferrer">/swagger</a> - Interactive API testing |
| <td><span class="badge bg-success">GET</span></td> | ||
| <td><code>/api/PortCaptainsApi</code></td> | ||
| <td>Get all port captains</td> |
There was a problem hiding this comment.
The guide documents /api/PortCaptainsApi, but there is no corresponding API controller/route in the current codebase (only ShipAgenciesApiController exists under Controllers/api). Either implement the missing endpoint(s) or adjust the documentation to only list actually available routes (or clearly mark planned modules).
| <td><span class="badge bg-success">GET</span></td> | ||
| <td><code>/api/TankCleaningRequestsApi</code></td> | ||
| <td>Get all tank cleaning requests</td> |
There was a problem hiding this comment.
The guide documents /api/TankCleaningRequestsApi, but there is no corresponding API controller/route in the current codebase. Either implement the missing endpoint(s) or update the documentation to match the actual routes exposed by the app.
| <td><span class="badge bg-success">GET</span></td> | |
| <td><code>/api/TankCleaningRequestsApi</code></td> | |
| <td>Get all tank cleaning requests</td> | |
| <td><span class="badge bg-secondary">N/A</span></td> | |
| <td><code>Not available</code></td> | |
| <td>Tank Cleaning API endpoints are not currently implemented. Refer to Swagger (<code>/swagger</code>) for available APIs.</td> |
| <div class="row mb-4"> | ||
| <div class="col-12"> | ||
| <h1 class="display-4 text-primary mb-3"> | ||
| <i class="bi bi-code-square"></i> API Endpoint Guide |
There was a problem hiding this comment.
Decorative Bootstrap icons inside headings (e.g., this one) are read by some screen readers as content. Consider adding aria-hidden="true" to purely decorative <i> icons (or providing an accessible name when the icon conveys meaning).
| </p> | ||
| <a href="/ShipAgency" class="btn btn-lg btn-gradient-primary me-2 shadow">Get Started</a> | ||
| <a href="/swagger" class="btn btn-outline-secondary btn-lg me-2">Try API</a> | ||
| <a href="/Home/ApiGuide" class="btn btn-outline-info btn-lg me-2">API Guide</a> |
There was a problem hiding this comment.
This new navigation link is hard-coded as an absolute path (/Home/ApiGuide). Using MVC tag helpers (asp-controller/asp-action) avoids issues when the app is hosted under a path base or when routes change, and it matches the navigation style used in _Layout.cshtml.
| <a href="/Home/ApiGuide" class="btn btn-outline-info btn-lg me-2">API Guide</a> | |
| <a asp-controller="Home" asp-action="ApiGuide" class="btn btn-outline-info btn-lg me-2">API Guide</a> |
| <td><span class="badge bg-success">GET</span></td> | ||
| <td><code>/api/ShipRepairsApi</code></td> | ||
| <td>Get all ship repair requests</td> |
There was a problem hiding this comment.
The guide documents /api/ShipRepairsApi, but there is no corresponding API controller/route in the current codebase. Either implement the missing endpoint(s) or update the documentation to match the actual routes exposed by the app.
| <td><span class="badge bg-success">GET</span></td> | |
| <td><code>/api/ShipRepairsApi</code></td> | |
| <td>Get all ship repair requests</td> | |
| <td><span class="badge bg-secondary">N/A</span></td> | |
| <td><span class="text-muted">Not currently available</span></td> | |
| <td>Planned endpoint for managing ship repair requests</td> |
| <td><span class="badge bg-success">GET</span></td> | ||
| <td><code>/api/UnderwaterServicesApi</code></td> | ||
| <td>Get all underwater service requests</td> |
There was a problem hiding this comment.
The guide documents /api/UnderwaterServicesApi, but there is no corresponding API controller/route in the current codebase. Either implement the missing endpoint(s) or update the documentation to match the actual routes exposed by the app.
| <td><span class="badge bg-success">GET</span></td> | |
| <td><code>/api/UnderwaterServicesApi</code></td> | |
| <td>Get all underwater service requests</td> | |
| <td><span class="badge bg-secondary">TBD</span></td> | |
| <td><code>TBD</code></td> | |
| <td>Endpoint for underwater service requests is planned and not yet available.</td> |
| Complete reference for all Ship Services REST API endpoints. All endpoints return JSON and follow REST conventions. | ||
| </p> | ||
| <div class="alert alert-info"> | ||
| <strong>Base URL:</strong> <code>http://localhost:5145/api</code><br> |
There was a problem hiding this comment.
The displayed Base URL is hard-coded to http://localhost:5145/api, which will be incorrect when the app runs on a different host/port (or under HTTPS / a reverse proxy). Consider showing a relative base (/api) or deriving the scheme/host at runtime so the guide stays accurate across environments.
| <strong>Base URL:</strong> <code>http://localhost:5145/api</code><br> | |
| <strong>Base URL:</strong> <code>@($"{Context.Request.Scheme}://{Context.Request.Host}/api")</code><br> |
| <!-- Crew Supply API --> | ||
| <div class="card mb-4 shadow-sm"> | ||
| <div class="card-header bg-warning text-dark"> | ||
| <h4 class="mb-0"> | ||
| <i class="bi bi-person-check-fill"></i> Crew Supply API | ||
| </h4> | ||
| </div> | ||
| <div class="card-body"> | ||
| <p class="card-text">Handle emergency crew requests and replacements.</p> | ||
| <table class="table table-striped"> | ||
| <thead> | ||
| <tr> | ||
| <th>Method</th> | ||
| <th>Endpoint</th> | ||
| <th>Description</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr> | ||
| <td><span class="badge bg-success">GET</span></td> | ||
| <td><code>/api/CrewRequestsApi</code></td> | ||
| <td>Get all crew requests</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| </div> | ||
|
|
There was a problem hiding this comment.
The guide documents /api/CrewRequestsApi, but there is no corresponding API controller/route in the current codebase. Either implement the missing endpoint(s) or update the documentation to match the actual routes exposed by the app.
| <!-- Crew Supply API --> | |
| <div class="card mb-4 shadow-sm"> | |
| <div class="card-header bg-warning text-dark"> | |
| <h4 class="mb-0"> | |
| <i class="bi bi-person-check-fill"></i> Crew Supply API | |
| </h4> | |
| </div> | |
| <div class="card-body"> | |
| <p class="card-text">Handle emergency crew requests and replacements.</p> | |
| <table class="table table-striped"> | |
| <thead> | |
| <tr> | |
| <th>Method</th> | |
| <th>Endpoint</th> | |
| <th>Description</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <tr> | |
| <td><span class="badge bg-success">GET</span></td> | |
| <td><code>/api/CrewRequestsApi</code></td> | |
| <td>Get all crew requests</td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> |
| <tbody> | ||
| <tr> | ||
| <td><span class="badge bg-success">GET</span></td> | ||
| <td><code>/api/CustomStoresApi</code></td> |
There was a problem hiding this comment.
The guide documents /api/CustomStoresApi, but there is no corresponding API controller/route in the current codebase. Either implement the missing endpoint(s) or update the documentation to match the actual routes exposed by the app.
| <td><code>/api/CustomStoresApi</code></td> | |
| <td>See <code>/swagger</code> for current Customs endpoints</td> |
Created a centralized API reference page documenting endpoints for all 9 service modules (Ship Agencies, Port Captaincy, Crew Supply, Supply Services, Ship Repairs, Customs Clearance, Underwater Services, Husbanding, Tank Cleaning).
Changes
Views/Home/ApiGuide.cshtml- API documentation with endpoint tables, response format examples, and Swagger UI linksApiGuide()action inHomeControllerImplementation
The guide uses color-coded Bootstrap cards per module with tables showing HTTP methods, endpoint paths, and descriptions:
Accessible via
/Home/ApiGuideor the new button on the home page.Screenshots
Home page with API Guide button:

API documentation page:

Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.