To use Spring Boot to create a simple API to management of people. Allowing the following operations:
- Create a person
- Edit a person
- Consult a person
- List people
- Create a person's address
- List a person's addresses
- Being able to inform a person's primary address
A person should have the following field structure:
{
"nome": "Ciclano",
"dataDeNascimento": "1995-07-18",
"enderecos": [
{
"logradouro": "Avenida Almirante Maximiano Fonseca",
"cep": "96204-040",
"numero": 16,
"cidade": "Rio Grande"
},
{
"logradouro": "Rua Serra de Bragança",
"cep": "03318-000",
"numero": 19,
"cidade": "São Paulo"
}
],
"enderecoPrincipal": {
"logradouro": "Rua Serra de Bragança",
"cep": "03318-000",
"numero": 19,
"cidade": "São Paulo"
}
}
- All the anwsers should return a JSON object
- Use H2 database
Here (a GET request) you can see the API in action. Please, don't abuse of them, it's running in a low instance of Azure App service.
- Create a person:
POST /pessoas
- Edit a person:
PUT /pessoas/{pessoaId}
- Consult a person:
GET /pessoas/{pessoaId}
- List people:
GET /pessoas
- Create a person's address:
PUT /pessoas/{pessoaId}/enderecos/criarEndereco
- List a person's addresses:
GET /pessoas/{pessoaId}/enderecos
- Being able to inform a person's primary address:
PUT /pessoas/{pessoaId}/enderecos/{posicaoEndereco}