This document provides an overview of the API's functionality, endpoints, usage instructions, and important considerations. This API serves as a backend resource for retrieving and managing information about various walking trails across New Zealand.
- Introduction
- Technologies Used
- Getting Started
- Endpoints
- Authentication
- Examples
- Contributing
- License
The New Zealand Walking Trails API is designed to provide users with information about various walking trails located in New Zealand. It allows users to retrieve details about different regions and the walks available within those regions.
- Programming Languages: C#
- Web Framework: ASP.NET Core
- Database: SQL
- ORM: Entity Framework Core
- Authentication: JWT (JSON Web Tokens)
- .NET Core SDK (version 7.0) or
-
Clone this repository to your local machine.
-
Navigate to the project directory using the terminal.
-
Run the following command to build and run the API:
dotnet run
-
The API will be accessible at
http://localhost:portNumber
.
GET /api/regions
: Get a list of all regions.GET /api/regions/{id}
: Get information about a specific region.POST /api/regions
: Create a new region (authentication required).PUT /api/regions/{id}
: Update information about a region (authentication required).DELETE /api/regions/{id}
: Delete a region (authentication required).
POST /api/walks
: Create a new walk (authentication required).GET /api/walks
: Get a list of walks with optional filtering, sorting, and pagination.GET /api/walks/{id}
: Get information about a specific walk.PUT /api/walks/{id}
: Update information about a walk (authentication required).DELETE /api/walks/{id}
: Delete a walk (authentication required).
The API uses JWT (JSON Web Tokens) for authentication. Certain endpoints require specific roles for access. Roles are defined as "Reader" and "Writer."
To authenticate, include the JWT token in the authorization header of your requests:
Authorization: Bearer <your_token_here>
GET /api/regions
Response:
[
{
"id": "region_id",
"name": "Region Name",
...
},
...
]