Inventory-Order-Management-Api
https://inventoryordermanagementapi.runasp.net/index.html
- RESTful API
- Swagger/OpenAPI-Documentation
- JWT-Authentification
- Role Based Access Control (RBAC)
- InMemory-Caching
- Deployment on monsterasp.net
- .NET 10 Sdk
- Entity Framework Core
- ASP.NET Core Identity
- Swagger / OpenAPI
- Sqlite
git clone https://github.com/msass89/InventoryOrderManagementApi.git
cd APIdotnet restoreappsettings.json
{
"Jwt": {
"Issuer": "...",
"Audience": "...",
"Key": "..."
}
}Alternatively it's recommended to set the JWT key by setting a user secret or an environment variable.
dotnet ef database updatedotnet runThe swagger UI is set to the root and is starting automatically when running the Api.
| Method | Route | Description |
|---|---|---|
| POST | /api/auth/register | Register a new user |
| POST | /api/auth/login | Login as a new user |
| GET | /api/inventory | Return all items in the inventory |
| GET | /api/inventory/{id} | Return item by Id |
| POST | /api/inventory | Create new Item |
| DELETE | /api/inventory/{id} | Delete item by Id |
| GET | /api/orders | Return all orders |
| GET | /api/orders/{id} | Return order by Id |
| POST | /api/orders | Create an orders |
| DELETE | /api/orders/{id} | Delete an order by Id |
This API is secured by JWT authentification and RBAC-based authorizaiton.
For accessing the endpoints please follow these steps:
- Use the endpoint 'api/auth/register' to register as a new user by providing a (fake) email adress, a password and the role. Possible roles are 'Admin', 'SalesAgent', 'InventoryAgent' or 'Customer'.
- Use the endpoint 'api/auth/login' in order to login with your provided user name and credentials.
- Copy the token in the API response without the parentheses.
- Click on 'Authorize' on the upper right corner of the Swagger UI.
- Paste the copied token into the input field.
- Confirm by clicking on 'Authorize'.
Now you are able to access the secured endpoints according to the user role.
Controller/
Data/
Seed/
Migrations/
Models/
DTO/
Entities/
Enums/
Program.cs
MIT