This is a simple API for managing phone contacts in a phone book. It allows you to add, retrieve, update, and delete contacts.
- Introduction
- Technologies Used
- Getting Started
- Endpoints
- Add Contact
- Get All Contacts
- Get Contact by ID
- Update Contact
- Delete Contact
The PhoneBook API provides a straightforward way to manage phone contacts. You can add, retrieve, update, and delete contacts using the provided endpoints.
- ASP.NET Core
- Entity Framework Core
- AutoMapper
Getting Started
- Clone the repository:
git clone https://github.com/yourusername/phonebook-api.git
- Navigate to the project directory:
cd phonebook-api
- Restore packages:
dotnet restore
- Build the project:
dotnet build
- Run the API:
dotnet run
Add a new contact to the phone book.
- URL: /phoneBook
- Method: POST
- Request Body:
{
"phoneNumber": "1234567890",
"alternativePhone": "9876543210",
"description": "Work",
"contactName": "John Doe"
}
- "alternativePhone" is optional
Retrieve a list of all contacts in the phone book.
- URL: /phoneBook
- Method: GET
- Query Parameters:
- skip (optional): Number of contacts to skip (default: 0).
- take (optional): Number of contacts to take (default: 10).
Retrieve a contact by its ID.
- URL: /phoneBook/{id}
- Method: GET
- URL Parameters:
- id: ID of the contact to retrieve.
Update an existing contact.
- URL: /phoneBook/{id}
- Method: PATCH
- URL Parameters:
- id: ID of the contact to update.
- Request Body:
{
"phoneNumber": "9876543210",
"alternativePhone": "1234567890",
"description": "Personal",
"contactName": "Jane Smith"
}
Delete a contact from the phone book.
- URL: /phoneBook/{id}
- Method: DELETE
- URL Parameters:
- id: ID of the contact to delete.