A Contacts API built with .Net 6 and Entity Framework Core which stores contact information for any person
The API implements CRUD operations
The API stores the data using In-Memory Database as well as SQL Database
The SQL Database operations are performed using Entity Framework Core & EF Migrations
The API is built based on the YouTube video ASP.NET Core Web API CRUD With Entity Framework - Full Course ⭐ [.NET6 API]
Simply run git clone https://github.com/saideepd/contacts-api-dotnet
and dotnet run --project ContactsAPI
.
GET /api/Contacts
200 OK
[
{
"id": "eef37882-168a-4e70-9681-19ecda2efe0e",
"fullName": "John Doe",
"email": "john.doe@email.com",
"phone": 1234567890,
"address": "221B Blecker Street, Old Town, NYC, USA"
},
{
"id": "1cc685ab-5ddc-4fcc-8b30-fea17f555617",
"fullName": "Jane Doe",
"email": "jane.doe@email.com",
"phone": 8989898081,
"address": "34th Bull Street, Manhattan, NJ, USA"
}
]
GET /api/Contact/{{id}}
200 OK
[
{
"id": "1cc685ab-5ddc-4fcc-8b30-fea17f555617",
"fullName": "Jane Doe",
"email": "jane.doe@email.com",
"phone": 8989898081,
"address": "34th Bull Street, Manhattan, NJ, USA"
}
]
POST /api/Contacts
200 OK
[
{
"id": "1cc685ab-5ddc-4fcc-8b30-fea17f555617",
"fullName": "Jane Doe",
"email": "jane.doe@email.com",
"phone": 8989898081,
"address": "34th Bull Street, Manhattan, NJ, USA"
}
]
PUT /api/Contacts/{{id}}
200 OK
[
{
"id": "1cc685ab-5ddc-4fcc-8b30-fea17f555617",
"fullName": "Janet Dane",
"email": "janet.dane@email.com",
"phone": 8989898081,
"address": "221B Baker Street, London, UK"
}
]
DELETE /api/Contacts/{{id}}
200 OK
[
{
"id": "1cc685ab-5ddc-4fcc-8b30-fea17f555617",
"fullName": "Janet Dane",
"email": "janet.dane@email.com",
"phone": 8989898081,
"address": "221B Baker Street, London, UK"
}
]
If any of the API does not have matching record present in Database to perform the respective operations, then the API returns 404 Not Found as response
GET /api/Contact/{{id}}
PUT /api/Contacts/{{id}}
DELETE /api/Contacts/{{id}}
404 Not Found
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.4",
"title": "Not Found",
"status": 404,
"traceId": "00-049191ed4040ae3b5fcb8cbb09908cc7-d69eb9f86a77c0f0-00"
}