CourseLibrary REST API built in .NET 6.
- .NET 6
- Microsoft.EntityFrameworkCore
- Microsoft.EntityFrameworkCore.Sqlite
- Microsoft.EntityFrameworkCore.Tools
- Microsoft.AspNetCore.Mvc.NewtonsoftJson
- Microsoft.AspNetCore.JsonPatch
- AutoMapper
- System.Linq.Dynamic.Core
- Get Authors
- Get Author
- Create Author
- Get Authors Options
- Get Courses For Author
- Get Course For Author
- Create Course For Author
- Update Course For Author
- Partially Update Course For Author
- Delete Course For Author
GET /api/authors
or with request query string optional parameters
GET /api/authors?mainCategory={{category}}&q={{searchQuery}}&pageNumber={{pageNum}}&pageSize={{pageSize}}
200 Ok
[
{
"id": "102b566b-ba1f-404c-b2df-e2cde39ade09",
"name": "Arnold The Unseen Stafford",
"age": 66,
"mainCategory": "Singing"
}
]
GET /api/authors/{{id}}
200 Ok
{
"id": "102b566b-ba1f-404c-b2df-e2cde39ade09",
"name": "Arnold The Unseen Stafford",
"age": 66,
"mainCategory": "Singing"
}
POST /api/authors
{
"firstName" : "Jane",
"lastName" : "Skewers",
"dateOfBirth" : "1968-03-04T00:00:00",
"mainCategory": "Rum"
}
201 Created
Location: {{host}}/api/authors/{{id}}
{
"id": "2d594794-5ce3-485a-981f-7c62fadbdd82",
"name": "Jane Skewers",
"age": 55,
"mainCategory": "Rum"
}
OPTIONS /api/authors
200 Ok
Headers: (No body)
{
"Allow": "GET,HEAD,POST,OPTIONS",
...
}
GET /api/authors/{{authorId}}/courses
200 Ok
[
{
"id": "5b1c2b4d-48c7-402a-80c3-cc796ad49c6b",
"title": "Commandeering a Ship Without Getting Caught",
"description": "Commandeering a ship in rough waters isn't easy. Commandeering it without getting caught is even harder. In this course you'll learn how to sailaway and avoid those pesky musketeers."
}
]
GET /api/authors/{{authorId}}/courses/{{courseId}}
200 Ok
{
"id": "5b1c2b4d-48c7-402a-80c3-cc796ad49c6b",
"title": "Commandeering a Ship Without Getting Caught",
"description": "Commandeering a ship in rough waters isn't easy. Commandeering it without getting caught is even harder. In this course you'll learn how to sail away and avoid those pesky musketeers."
}
POST /api/authors/{{authorId}}/courses
{
"title" : "Top Pirate Hits of Last Decade",
"description" : "Learn the lyrics and notes to the latest pirate hits"
}
201 Created
Location: {{host}}/api/authors/{{authorId}}/courses/{{courseId}}
{
"id": "015ddd8a-ed8c-4116-bca5-8f155a7c8ba5",
"title": "Top Pirate Hits of Last Decade",
"description": "Learn the lyrics and notes to the latest pirate hits"
}
PUT /api/authors/{{authorId}}/courses/{{courseId}}
{
"title": "Updated title",
"description": "Updated description"
}
204 No Content
or
201 Created
Location: {{host}}/api/authors/{{authorId}}/courses/{{courseId}}
{
"id": "015ddd8a-ed8c-4116-bca5-8f155a7c8ba5",
"title": "Updated title",
"description": "Updated description"
}
PATCH /api/authors/{{authorId}}/courses/{{courseId}}
[
{
"op": "replace",
"path": "/title",
"value": "Updated title"
}
]
204 No Content
or
201 Created
Location: {{host}}/api/authors/{{authorId}}/courses/{{courseId}}
{
"id": "015ddd8a-ed8c-4116-bca5-8f155a7c8ba5",
"title": "Updated title",
"description": "Updated description"
}
DELETE /api/authors/{{authorId}}/courses/{{courseId}}
204 No Content
The software is available as open source under the terms of the MIT License.