Documentação do projeto criado na segunda fase do curso de pós-graduação em Arquitetura e Desenvolvimento Java da FIAP.
A seguir estão as principais tecnologias e ferramentas utilizadas no desenvolvimento da API REST:
-
Spring Boot: Um framework Java que simplifica o desenvolvimento de aplicativos Java, fornecendo configurações e dependências por padrão, facilitando a criação de uma API REST robusta e escalável.
-
Java 17: A linguagem de programação principal utilizada para desenvolver a API REST.
-
Spring Framework: Fornece um conjunto abrangente de recursos para desenvolvimento de aplicativos empresariais, incluindo gerenciamento de dependências, injeção de dependência, segurança, controle transacional e muito mais.
-
Spring Data JPA: Uma biblioteca do Spring que facilita a integração de aplicativos Java com bancos de dados relacionais usando a especificação JPA (Java Persistence API).
-
Hibernate: Um framework de mapeamento objeto-relacional (ORM) utilizado em conjunto com o Spring Data JPA para facilitar o acesso e manipulação dos dados no banco de dados.
-
MySQL: Um banco de dados relacional utilizado como banco de dados principal para a API REST.
-
Postman: Uma ferramenta de desenvolvimento de API que facilita o teste e a documentação das chamadas de API.
-
Lombok: O Project Lombok é uma biblioteca para a linguagem de programação Java que oferece recursos para reduzir a verbosidade do código, simplificar a criação de classes e aumentar a produtividade do desenvolvedor.
-
Springdoc: O Springdoc é uma biblioteca que facilita a geração automática de documentação no padrão OpenAPI para APIs RESTful desenvolvidas com o framework Spring Boot.
#para subir o banco de dados
docker compose -f database-composer.yml up
Base URLs:
Code samples
# You can also use wget
curl -X GET http://localhost:8080/api/person \
-H 'Accept: application/json'
GET http://localhost:8080/api/person HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/person',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'http://localhost:8080/api/person',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('http://localhost:8080/api/person', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','http://localhost:8080/api/person', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/person");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "http://localhost:8080/api/person", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /person
Get all persons
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns all persons | PersonDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X PUT http://localhost:8080/api/person \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
PUT http://localhost:8080/api/person HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Accept: application/json
const inputBody = '{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('http://localhost:8080/api/person',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.put 'http://localhost:8080/api/person',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.put('http://localhost:8080/api/person', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PUT','http://localhost:8080/api/person', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/person");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "http://localhost:8080/api/person", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /person
Update a person
Body parameter
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | PersonDTO | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns the update person | PersonDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X POST http://localhost:8080/api/person \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
POST http://localhost:8080/api/person HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Accept: application/json
const inputBody = '{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('http://localhost:8080/api/person',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post 'http://localhost:8080/api/person',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('http://localhost:8080/api/person', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','http://localhost:8080/api/person', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/person");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "http://localhost:8080/api/person", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /person
Create a person
Body parameter
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | PersonDTO | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns the created person | PersonDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X GET http://localhost:8080/api/person/{id} \
-H 'Accept: application/json'
GET http://localhost:8080/api/person/{id} HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/person/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'http://localhost:8080/api/person/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('http://localhost:8080/api/person/{id}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','http://localhost:8080/api/person/{id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/person/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "http://localhost:8080/api/person/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /person/{id}
Gets a person by ID
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string(uuid) | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns the person | PersonDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X DELETE http://localhost:8080/api/person/{id} \
-H 'Accept: application/json'
DELETE http://localhost:8080/api/person/{id} HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/person/{id}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.delete 'http://localhost:8080/api/person/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.delete('http://localhost:8080/api/person/{id}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','http://localhost:8080/api/person/{id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/person/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "http://localhost:8080/api/person/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /person/{id}
Deletes a person by ID
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string(uuid) | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Empty return | PersonDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X GET http://localhost:8080/api/person/filter?filter=name,string,email,string,phoneNumber,string,gender,string,birthDate,2019-08-24,parentEmail,string \
-H 'Accept: application/json'
GET http://localhost:8080/api/person/filter?filter=name,string,email,string,phoneNumber,string,gender,string,birthDate,2019-08-24,parentEmail,string HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/person/filter?filter=name,string,email,string,phoneNumber,string,gender,string,birthDate,2019-08-24,parentEmail,string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'http://localhost:8080/api/person/filter',
params: {
'filter' => '[PersonFilterDTO](#schemapersonfilterdto)'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('http://localhost:8080/api/person/filter', params={
'filter': {
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parentEmail": "string"
}
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','http://localhost:8080/api/person/filter', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/person/filter?filter=name,string,email,string,phoneNumber,string,gender,string,birthDate,2019-08-24,parentEmail,string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "http://localhost:8080/api/person/filter", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /person/filter
Get filtered persons
Name | In | Type | Required | Description |
---|---|---|---|---|
filter | query | PersonFilterDTO | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns filtered persons | PersonDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X GET http://localhost:8080/api/homeappliance \
-H 'Accept: application/json'
GET http://localhost:8080/api/homeappliance HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/homeappliance',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'http://localhost:8080/api/homeappliance',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('http://localhost:8080/api/homeappliance', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','http://localhost:8080/api/homeappliance', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/homeappliance");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "http://localhost:8080/api/homeappliance", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /homeappliance
Get all the home appliances
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string",
"owner": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns all the home appliance | HomeApplianceDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X PUT http://localhost:8080/api/homeappliance \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
PUT http://localhost:8080/api/homeappliance HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Accept: application/json
const inputBody = '{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string",
"owner": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('http://localhost:8080/api/homeappliance',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.put 'http://localhost:8080/api/homeappliance',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.put('http://localhost:8080/api/homeappliance', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PUT','http://localhost:8080/api/homeappliance', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/homeappliance");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "http://localhost:8080/api/homeappliance", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /homeappliance
Update a home appliance
Body parameter
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string",
"owner": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | HomeApplianceDTO | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string",
"owner": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns the update home appliance | HomeApplianceDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X POST http://localhost:8080/api/homeappliance \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
POST http://localhost:8080/api/homeappliance HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Accept: application/json
const inputBody = '{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string",
"owner": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('http://localhost:8080/api/homeappliance',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post 'http://localhost:8080/api/homeappliance',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('http://localhost:8080/api/homeappliance', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','http://localhost:8080/api/homeappliance', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/homeappliance");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "http://localhost:8080/api/homeappliance", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /homeappliance
Create a home appliance
Body parameter
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string",
"owner": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | HomeApplianceDTO | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string",
"owner": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns the created home appliance | HomeApplianceDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X GET http://localhost:8080/api/homeappliance/{id} \
-H 'Accept: application/json'
GET http://localhost:8080/api/homeappliance/{id} HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/homeappliance/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'http://localhost:8080/api/homeappliance/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('http://localhost:8080/api/homeappliance/{id}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','http://localhost:8080/api/homeappliance/{id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/homeappliance/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "http://localhost:8080/api/homeappliance/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /homeappliance/{id}
Gets a home appliance by ID
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string(uuid) | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string",
"owner": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns the home appliance | HomeApplianceDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X DELETE http://localhost:8080/api/homeappliance/{id} \
-H 'Accept: application/json'
DELETE http://localhost:8080/api/homeappliance/{id} HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/homeappliance/{id}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.delete 'http://localhost:8080/api/homeappliance/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.delete('http://localhost:8080/api/homeappliance/{id}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','http://localhost:8080/api/homeappliance/{id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/homeappliance/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "http://localhost:8080/api/homeappliance/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /homeappliance/{id}
Deletes a home appliance by ID
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string(uuid) | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string",
"owner": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Empty return | HomeApplianceDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X GET http://localhost:8080/api/homeappliance/filter?filter=name,string,description,string,type,BLENDER,brand,string,powerInWatts,string,voltage,string,model,string \
-H 'Accept: application/json'
GET http://localhost:8080/api/homeappliance/filter?filter=name,string,description,string,type,BLENDER,brand,string,powerInWatts,string,voltage,string,model,string HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/homeappliance/filter?filter=name,string,description,string,type,BLENDER,brand,string,powerInWatts,string,voltage,string,model,string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'http://localhost:8080/api/homeappliance/filter',
params: {
'filter' => '[HomeApplianceFilterDTO](#schemahomeappliancefilterdto)'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('http://localhost:8080/api/homeappliance/filter', params={
'filter': {
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string"
}
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','http://localhost:8080/api/homeappliance/filter', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/homeappliance/filter?filter=name,string,description,string,type,BLENDER,brand,string,powerInWatts,string,voltage,string,model,string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "http://localhost:8080/api/homeappliance/filter", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /homeappliance/filter
Get the filtered home appliances
Name | In | Type | Required | Description |
---|---|---|---|---|
filter | query | HomeApplianceFilterDTO | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string",
"owner": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns the filtered home appliances | HomeApplianceDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X GET http://localhost:8080/api/address \
-H 'Accept: application/json'
GET http://localhost:8080/api/address HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/address',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'http://localhost:8080/api/address',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('http://localhost:8080/api/address', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','http://localhost:8080/api/address', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/address");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "http://localhost:8080/api/address", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /address
Get all the addresses
Example responses
400 Response
{
"errorMessage": "string",
"exception": "string"
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns all the addresses | None |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X PUT http://localhost:8080/api/address \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
PUT http://localhost:8080/api/address HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Accept: application/json
const inputBody = '{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('http://localhost:8080/api/address',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.put 'http://localhost:8080/api/address',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.put('http://localhost:8080/api/address', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PUT','http://localhost:8080/api/address', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/address");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "http://localhost:8080/api/address", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /address
Update an address
Body parameter
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | AddressDTO | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns the updated address | AddressDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X POST http://localhost:8080/api/address \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
POST http://localhost:8080/api/address HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Accept: application/json
const inputBody = '{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}';
const headers = {
'Content-Type':'application/json',
'Accept':'application/json'
};
fetch('http://localhost:8080/api/address',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
result = RestClient.post 'http://localhost:8080/api/address',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
r = requests.post('http://localhost:8080/api/address', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','http://localhost:8080/api/address', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/address");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "http://localhost:8080/api/address", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /address
Create an address
Body parameter
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
Name | In | Type | Required | Description |
---|---|---|---|---|
body | body | AddressDTO | true | none |
Example responses
201 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | Returns the created address | AddressDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X GET http://localhost:8080/api/address/{id} \
-H 'Accept: application/json'
GET http://localhost:8080/api/address/{id} HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/address/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'http://localhost:8080/api/address/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('http://localhost:8080/api/address/{id}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','http://localhost:8080/api/address/{id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/address/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "http://localhost:8080/api/address/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /address/{id}
Gets an address by ID
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string(uuid) | true | none |
Example responses
200 Response
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns the address | AddressDTO |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X DELETE http://localhost:8080/api/address/{id} \
-H 'Accept: application/json'
DELETE http://localhost:8080/api/address/{id} HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/address/{id}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.delete 'http://localhost:8080/api/address/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.delete('http://localhost:8080/api/address/{id}', headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','http://localhost:8080/api/address/{id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/address/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "http://localhost:8080/api/address/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /address/{id}
Deletes an address by ID
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | string(uuid) | true | none |
Example responses
400 Response
{
"errorMessage": "string",
"exception": "string"
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Empty return | None |
400 | Bad Request | Returns the error | ErrorDTO |
Code samples
# You can also use wget
curl -X GET http://localhost:8080/api/address/filter?filter=id,497f6eca-6276-4993-bfeb-53cbbbba6f08,streetName,string,neighborhood,string,city,string,state,string \
-H 'Accept: application/json'
GET http://localhost:8080/api/address/filter?filter=id,497f6eca-6276-4993-bfeb-53cbbbba6f08,streetName,string,neighborhood,string,city,string,state,string HTTP/1.1
Host: localhost:8080
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('http://localhost:8080/api/address/filter?filter=id,497f6eca-6276-4993-bfeb-53cbbbba6f08,streetName,string,neighborhood,string,city,string,state,string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'http://localhost:8080/api/address/filter',
params: {
'filter' => '[AddressFilterDTO](#schemaaddressfilterdto)'
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('http://localhost:8080/api/address/filter', params={
'filter': {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string"
}
}, headers = headers)
print(r.json())
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','http://localhost:8080/api/address/filter', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("http://localhost:8080/api/address/filter?filter=id,497f6eca-6276-4993-bfeb-53cbbbba6f08,streetName,string,neighborhood,string,city,string,state,string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "http://localhost:8080/api/address/filter", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /address/filter
Get the filtered addresses
Name | In | Type | Required | Description |
---|---|---|---|---|
filter | query | AddressFilterDTO | true | none |
Example responses
400 Response
{
"errorMessage": "string",
"exception": "string"
}
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Returns the filtered addresses | None |
400 | Bad Request | Returns the error | ErrorDTO |
{
"errorMessage": "string",
"exception": "string"
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
errorMessage | string | false | none | none |
exception | string | false | none | none |
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string(uuid) | false | none | none |
streetName | string | true | none | none |
neighborhood | string | true | none | none |
city | string | true | none | none |
state | string | true | none | none |
number | integer(int32) | true | none | none |
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string(uuid) | false | none | none |
name | string | true | none | none |
string | true | none | none | |
phoneNumber | string | true | none | none |
gender | string | false | none | none |
birthDate | string(date) | true | none | none |
parent | PersonDTO | false | none | none |
addresses | [AddressDTO] | false | none | none |
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string",
"owner": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parent": {},
"addresses": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string",
"number": 0
}
]
}
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string(uuid) | false | none | none |
name | string | true | none | none |
description | string | true | none | none |
type | string | true | none | none |
brand | string | true | none | none |
powerInWatts | string | true | none | none |
voltage | string | true | none | none |
model | string | true | none | none |
owner | PersonDTO | false | none | none |
Property | Value |
---|---|
type | BLENDER |
type | AIR_CONDITIONER |
type | VACUUM_CLEANER |
type | MICROWAVE |
type | STOVE |
type | WASHING_MACHINE |
type | TV |
type | REFRIGERATOR |
type | ELECTRIC_COOKER |
type | TOASTER |
type | COFFEE_MAKER |
{
"name": "string",
"email": "string",
"phoneNumber": "string",
"gender": "string",
"birthDate": "2019-08-24",
"parentEmail": "string"
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
name | string | false | none | none |
string | false | none | none | |
phoneNumber | string | false | none | none |
gender | string | false | none | none |
birthDate | string(date) | false | none | none |
parentEmail | string | false | none | none |
{
"name": "string",
"description": "string",
"type": "BLENDER",
"brand": "string",
"powerInWatts": "string",
"voltage": "string",
"model": "string"
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
name | string | false | none | none |
description | string | false | none | none |
type | string | false | none | none |
brand | string | false | none | none |
powerInWatts | string | false | none | none |
voltage | string | false | none | none |
model | string | false | none | none |
Property | Value |
---|---|
type | BLENDER |
type | AIR_CONDITIONER |
type | VACUUM_CLEANER |
type | MICROWAVE |
type | STOVE |
type | WASHING_MACHINE |
type | TV |
type | REFRIGERATOR |
type | ELECTRIC_COOKER |
type | TOASTER |
type | COFFEE_MAKER |
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"streetName": "string",
"neighborhood": "string",
"city": "string",
"state": "string"
}
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string(uuid) | false | none | none |
streetName | string | false | none | none |
neighborhood | string | false | none | none |
city | string | false | none | none |
state | string | false | none | none |