Skip to content

Mariusz225/company_info_rest_api

Repository files navigation

Company Information REST API

Description

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.

Getting started

To run this project, you'll need Docker and Docker Compose installed on your system.

Installation

  1. Clone this repository to your local machine:
    git clone https://github.com/Mariusz225/company_info_rest_api.git
  2. Navigate to the project directory:
    cd company-info-rest-api
  3. Build and start the Docker containers:
    docker-compose up -d --build
  4. Install project dependencies using Composer:
    docker exec -it company_info_rest_api-php-1 composer install
  5. Run database migrations to set up the database schema:
    docker exec -it company_info_rest_api-php-1 php bin/console doctrine:migrations:migrate

Usage

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}"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published