A collection of .NET RESTful APIs that provides information on New Zealand's walks, trails, and natural landmarks. This project includes secure, reliable endpoints to manage and access walk data for applications featuring New Zealand's natural beauty.
- CRUD Operations: Full Create, Read, Update, and Delete functionality for walk and Regions data.
- Secure Authentication & Authorization: JWT-based security for protected endpoints.
- Data Validation: Ensures incoming data meets required structure and integrity.
- Error Handling: Consistent error responses for seamless client-side handling.
- Scalability: Designed to scale with ease for additional endpoints and data sources.
- .NET SDK 8.0
- SQL Server (local or cloud instance)
- Postman or any REST client (for testing)
-
Clone the repository:
git clone https://github.com/itsumarsoomro/NZWALK-.NetRestfulAPIs.git cd NZWALK-.NetRestfulAPIs -
Install Dependencies:
dotnet restore
-
Database Setup:
- Update the SQL Server connection string in
appsettings.json:{ "ConnectionStrings": { "DefaultConnection": "Server=YOUR_SERVER;Database=NZWalksDB;Trusted_Connection=True;" } } - Run migrations to create the database schema:
dotnet ef database update
- Update the SQL Server connection string in
-
Run the Application:
dotnet run
The API will be running at
http://localhost:7033.
Use Postman or any REST client to test the API. Refer to the API Endpoints section for routes and parameters.
The API uses JWT tokens for secure access. Obtain a token from the login endpoint and include it as a Bearer token in your requests.
POST /api/auth/Login- Authenticate and receive a JWT token.POST /api/auth/Register- Register
POST /api/Images/Upload- Upload Images
GET /api/Student- Get all student.
GET /api/Walks- Get all walks.GET /api/Walks/{id}- Get details for a specific walk.POST /api/Walks- Create a new walk (requires authentication).PUT /api/Walks/{id}- Update a walk (requires authentication).DELETE /api/Walks/{id}- Delete a walk (requires authentication).
GET /api/Regions- List all regions.GET /api/Regions/{id}- Retrieve details for a specific region by id.GET /api/Regions/{code}- Retrieve details for a specific region by code.POST /api/Regions- Create a new Regions (requires authentication).PUT /api/Regions/{id}- Update a Regions (requires authentication).DELETE /api/Regions/{id}- Delete a Regions (requires authentication).
Contributions are welcome! To contribute:
- Fork the repository
- Create a new feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature description" - Push the branch:
git push origin feature-name
- Open a pull request
This project is licensed under the MIT License. See the LICENSE file for details.
