Api REST usando java e Spring Boot, feita durante workshop MSR da algaworks
10K+
Api REST usando java e Spring Boot, feita durante workshop MSR da algaworks. Alem disso, possui a documentaçao usando OpenAPI 3.0 e requisições HTTPS.
{
"openapi": "3.0.1",
"info": {
"title": "Log Api",
"description": "Aplicação desenvolvida para testes.",
"contact": {
"name": "gasfgrv",
"url": "https://github.com/gasfgrv",
"email": "[email protected]"
},
"license": {
"name": "Apache License Version 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0"
},
"version": "v1"
},
"servers": [
{
"url": "https://localhost:8443/",
"description": "Generated server url"
}
],
"tags": [
{
"name": "Ocorrências",
"description": "Endpoint para tratamento de Ocorrências relacionadas a uma entrega"
},
{
"name": "Clientes",
"description": "Endpoint para manipulação dos dados de um cliente"
},
{
"name": "Entregas",
"description": "Endpoint para tratamento das entregas"
}
],
"paths": {
"/entregas/{entregaId}/finalizacao": {
"put": {
"tags": [
"Entregas"
],
"summary": "Finalizar entrega",
"description": "Finalizar uma determinada entregas a partir do id",
"operationId": "finalizar",
"parameters": [
{
"name": "entregaId",
"in": "path",
"description": "Id da entrega",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"200": {
"description": "Entrega finalizada"
},
"204": {
"description": "No Content"
}
}
}
},
"/clientes/{clienteId}": {
"get": {
"tags": [
"Clientes"
],
"summary": "Buscar cliente",
"description": "Buscar determinado cliente a partir do id",
"operationId": "buscar_1",
"parameters": [
{
"name": "clienteId",
"in": "path",
"description": "Id do cliente",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"404": {
"description": "Cliente não encontrado",
"content": {
"application/json": {
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"200": {
"description": "Cliente encontrado",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Cliente"
}
}
}
}
}
},
"put": {
"tags": [
"Clientes"
],
"summary": "Atualizar cliente",
"description": "Atualizar dados do cliente",
"operationId": "atualizar",
"parameters": [
{
"name": "clienteId",
"in": "path",
"description": "Id do cliente",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"requestBody": {
"description": "Formulário de atualização",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClienteInput"
}
}
},
"required": true
},
"responses": {
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"200": {
"description": "Cliente atualizado",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClienteModel"
}
}
}
}
}
},
"delete": {
"tags": [
"Clientes"
],
"summary": "Deletar cliente",
"description": "Deletar dados do cliente",
"operationId": "remover",
"parameters": [
{
"name": "clienteId",
"in": "path",
"description": "Id do cliente",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"204": {
"description": "Cliente apagado",
"content": {
"application/json": {
}
}
}
}
}
},
"/entregas": {
"get": {
"tags": [
"Entregas"
],
"summary": "Listar entregas",
"description": "Listar todas as entregas salvas",
"operationId": "listar",
"responses": {
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"200": {
"description": "Todas as entregas",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EntregaModel"
}
}
}
}
}
},
"post": {
"tags": [
"Entregas"
],
"summary": "Solicitar entrega",
"description": "Vincula um clienate à entrega e cria a mesma",
"operationId": "solicitar",
"requestBody": {
"description": "Formulário de cadastro",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EntregaInput"
}
}
},
"required": true
},
"responses": {
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"201": {
"description": "Entrega solicitada",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EntregaModel"
}
}
}
}
}
}
},
"/entregas/{entregaId}/ocorrencias": {
"get": {
"tags": [
"Ocorrências"
],
"summary": "Listar ocorrências",
"description": "Listar todas as ocorrências relacionadas a uma entrega",
"operationId": "listar_1",
"parameters": [
{
"name": "entregaId",
"in": "path",
"description": "Id da entrega",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"200": {
"description": "Todos as ocorrências",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OcorrenciaModel"
}
}
}
}
}
},
"post": {
"tags": [
"Ocorrências"
],
"summary": "Registrar ocorrencias",
"description": "Vincula uma ocorrência a uma entrega",
"operationId": "registrar",
"parameters": [
{
"name": "entregaId",
"in": "path",
"description": "Id da entrega",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"requestBody": {
"description": "dados da ocorrência",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OcorrenciaInput"
}
}
},
"required": true
},
"responses": {
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"201": {
"description": "Ocorrência registrada",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OcorrenciaModel"
}
}
}
}
}
}
},
"/clientes": {
"get": {
"tags": [
"Clientes"
],
"summary": "Listar clientes",
"description": "Listar todos os clientes salvos",
"operationId": "listar_2",
"responses": {
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"200": {
"description": "Todos os clientes",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClienteResumoModel"
}
}
}
}
}
},
"post": {
"tags": [
"Clientes"
],
"summary": "Salvar cliente",
"description": "Salvar cliente na base",
"operationId": "adicionar",
"requestBody": {
"description": "Formulário de cadastro",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClienteInput"
}
}
},
"required": true
},
"responses": {
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"201": {
"description": "Cliente Salvo",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Cliente"
}
}
}
}
}
}
},
"/entregas/{entregaId}": {
"get": {
"tags": [
"Entregas"
],
"summary": "Buscar entrega",
"description": "Buscar determinada entrega a partir do id",
"operationId": "buscar",
"parameters": [
{
"name": "entregaId",
"in": "path",
"description": "Id da entrega",
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"404": {
"description": "Entrega não encontrada",
"content": {
"application/json": {
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Problema"
}
}
}
},
"200": {
"description": "Entrega encontrada",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EntregaModel"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Campo": {
"type": "object",
"properties": {
"nome": {
"type": "string"
},
"mensagem": {
"type": "string"
}
}
},
"Problema": {
"type": "object",
"properties": {
"status": {
"type": "integer",
"format": "int32"
},
"dataHora": {
"type": "string",
"format": "date-time"
},
"titulo": {
"type": "string"
},
"campos": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Campo"
}
}
}
},
"ClienteInput": {
"required": [
"email",
"nome",
"telefone"
],
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"nome": {
"maxLength": 60,
"minLength": 0,
"type": "string"
},
"email": {
"maxLength": 255,
"minLength": 0,
"type": "string"
},
"telefone": {
"maxLength": 20,
"minLength": 0,
"type": "string"
}
}
},
"ClienteModel": {
"type": "object",
"properties": {
"nome": {
"type": "string"
},
"email": {
"type": "string"
},
"telefone": {
"type": "string"
}
}
},
"ClienteIdInput": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
}
}
},
"DestinatarioInput": {
"required": [
"bairro",
"complemento",
"logradouro",
"nome",
"numero"
],
"type": "object",
"properties": {
"nome": {
"type": "string"
},
"logradouro": {
"type": "string"
},
"numero": {
"type": "string"
},
"complemento": {
"type": "string"
},
"bairro": {
"type": "string"
}
}
},
"EntregaInput": {
"required": [
"cliente",
"destinatario",
"taxa"
],
"type": "object",
"properties": {
"cliente": {
"$ref": "#/components/schemas/ClienteIdInput"
},
"destinatario": {
"$ref": "#/components/schemas/DestinatarioInput"
},
"taxa": {
"type": "number"
}
}
},
"ClienteResumoModel": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"nome": {
"type": "string"
}
}
},
"DestinatarioModel": {
"type": "object",
"properties": {
"nome": {
"type": "string"
},
"logradouro": {
"type": "string"
},
"numero": {
"type": "string"
},
"complemento": {
"type": "string"
},
"bairro": {
"type": "string"
}
}
},
"EntregaModel": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"cliente": {
"$ref": "#/components/schemas/ClienteResumoModel"
},
"destinatario": {
"$ref": "#/components/schemas/DestinatarioModel"
},
"taxa": {
"type": "number"
},
"status": {
"type": "string",
"enum": [
"PENDENTE",
"FINALIZADA",
"CANCELADA"
]
},
"dataPedido": {
"type": "string",
"format": "date-time"
},
"dataFinalizacao": {
"type": "string",
"format": "date-time"
}
}
},
"OcorrenciaInput": {
"required": [
"descricao"
],
"type": "object",
"properties": {
"descricao": {
"type": "string"
}
}
},
"OcorrenciaModel": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"descricao": {
"type": "string"
},
"dataRegistro": {
"type": "string",
"format": "date-time"
}
}
},
"Cliente": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"nome": {
"type": "string"
},
"email": {
"type": "string"
},
"telefone": {
"type": "string"
}
}
}
}
}
}
Finalizar entrega
Finalizar uma determinada entregas a partir do id
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| entregaId | path | Id da entrega | Yes | long |
| Code | Description |
|---|---|
| 200 | Entrega finalizada |
| 204 | No Content |
| 400 | Bad Request |
| 404 | Not Found |
Buscar cliente
Buscar determinado cliente a partir do id
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| clienteId | path | Id do cliente | Yes | long |
| Code | Description |
|---|---|
| 200 | Cliente encontrado |
| 400 | Bad Request |
| 404 | Cliente não encontrado |
Atualizar cliente
Atualizar dados do cliente
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| clienteId | path | Id do cliente | Yes | long |
| Code | Description |
|---|---|
| 200 | Cliente atualizado |
| 400 | Bad Request |
| 404 | Not Found |
Deletar cliente
Deletar dados do cliente
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| clienteId | path | Id do cliente | Yes | long |
| Code | Description |
|---|---|
| 204 | Cliente apagado |
| 400 | Bad Request |
| 404 | Not Found |
Listar entregas
Listar todas as entregas salvas
| Code | Description |
|---|---|
| 200 | Todas as entregas |
| 400 | Bad Request |
| 404 | Not Found |
Solicitar entrega
Vincula um clienate à entrega e cria a mesma
| Code | Description |
|---|---|
| 201 | Entrega solicitada |
| 400 | Bad Request |
| 404 | Not Found |
Listar ocorrências
Listar todas as ocorrências relacionadas a uma entrega
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| entregaId | path | Id da entrega | Yes | long |
| Code | Description |
|---|---|
| 200 | Todos as ocorrências |
| 400 | Bad Request |
| 404 | Not Found |
Registrar ocorrencias
Vincula uma ocorrência a uma entrega
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| entregaId | path | Id da entrega | Yes | long |
| Code | Description |
|---|---|
| 201 | Ocorrência registrada |
Content type
Image
Digest
sha256:d2e75275d…
Size
359.8 MB
Last updated
over 3 years ago
docker pull gustosilva/log-api