This is a Symfony-based REST API application that allows users to submit information about a company, including the company's name, NIP, address, city, and postcode, as well as information about its employees, such as name, surname, and email. All fields are mandatory except for the phone number, which is optional.
To run this project, you'll need Docker and Docker Compose installed on your system.
- Clone this repository to your local machine:
git clone https://github.com/Mariusz225/company_info_rest_api.git
- Navigate to the project directory:
cd company-info-rest-api
- Build and start the Docker containers:
docker-compose up -d --build
- Install project dependencies using Composer:
docker exec -it company_info_rest_api-php-1 composer install
- Run database migrations to set up the database schema:
docker exec -it company_info_rest_api-php-1 php bin/console doctrine:migrations:migrate
To interact with the API, you can use the following endpoint to create a company with employees: Create a Company with Employees
Endpoint: /api/company/createCompanyWithEmployees
HTTP Method: POST
Request Body:
{
"company": {
"name": "Company name",
"nip": "0000000000",
"address": "Company address",
"city": "Company city",
"postcode": "123-321",
"employees": [
{
"employee": {
"name": "name1",
"surname": "surname1",
"email": "[email protected]"
}
},
{
"employee": {
"name": "name2",
"surname": "surname2",
"email": "[email protected]"
}
}
]
}
}
Response:
{
"companyId": "{id of created company}"
}