API REST feita 100% em Java com Spring

Overview

Projeto Vaga Java JR.

API REST feita 100% em Java com Spring.


⚒️ Ferramentas Usadas ⚒️

  • SprigBoot

  • SpringData

  • Spring WEB

  • Banco de Dados H2


🗒 Documentação 🗒

Clique em Clientes, Games e Carrinho de compra para ler a documentação de cada um.

🔰 CLIENTES (clique aqui) 🔰

➤ [POST] save()

http://localhost:8080/api/clientes

{
  "nome": "Tommy Dalvino",
  "contato": "(92) 0000-000",
  "endereco": {
        "rua": "av. max teixeira",
        "numCasa": 333
   }
}

  • se salvar retorná status 201;

  • todos os campos são obrigatórios.

➤ [GET] FindAll()

http://localhost:8080/api/clientes
  • Retornará todos os clientes;

➤ [GET] FindById()

http://localhost:8080/api/clientes/{id}
  • se informar um id inexistente retornará um status 404;

➤ [DELETE] DeleteById()

http://localhost:8080/api/clientes/{id}
  • id do cliente a ser deletado deve ser passado na URI;

  • se deletar retornará status 204;

  • se passar um id inexistente retornará um status 404;

➤ [PUT] update()

http://localhost:8080/api/clientes/{id}

{
   "nome": "novoNome",
    "contato": "novoContato",
    "endereco": {
          "rua": "novaRua",
          "numCasa": 000
       }
}

  • Id do cliente a ser atualizado deve ser informado na URI;

  • se atualizar retonará um status 200 OK;

  • se informar um id inexistente retornará um status 404;

🔰 GAMES (clique aqui) 🔰

➤ [GET] findAll()

http://localhost:8080/api/games
    • Trará todos os games do banco de dados;

➤ [GET] findById()

http://localhost:8080/api/games/{id}
  • pesquisa um game por id

  • id do game deve ser informado na URI;

  • retornará status 404 caso o id não seja encontrado;

➤ [DELETE] deleteById()

http://localhost:8080/api/games/{id}
  • Id do game a ser deletado deve ser passado na URI

  • se o game estiver associado a um carrinho vai disparar um erro 409

  • se id n corresponder a nenhum carrinho vai disparar um erro 404

➤ [GET] findByPrecoAsc()

http://localhost:8080/api/games/preco-asc
  • Ordena os preços de maneira ascendente

➤ [GET] findByPrecoDesc()

http://localhost:8080/api/games/preco-desc
  • Ordena os preços de maneira descendente

➤ [GET] findByOrdemAlfabetica()

http://localhost:8080/api/games/ordemnome
  • Retorna os games em ordem alfabética

➤ [POST] save()

http://localhost:8080/api/games
 
{
  "nome": "nomeGame",
  "urlImagem": null,
  "descricao": null,
  "preco": 0.0
}

  • Nome e Preço são obrigarórios, o restante dos campos não.

  • Retorna um status 201 se salvar;

➤ [PUT] update()

http://localhost:8080/api/games/{id}
 
{
  "nome": "nomeGame",
  "urlImagem": null,
  "descricao": null,
  "preco": 0.0
}

  • o id do game a ser atualizado deve ser passado na URI

  • retornará um status 200 OK se atualizar

🔰 CARRINHO DE COMPRA (clique aqui) 🔰

➤ [GET] findAll()

http://localhost:8080/api/carrinhos
  • retorna todos os carrinhos

➤ [GET] findById()

http://localhost:8080/api/carrinhos/{id}
  • busca um carrinho pelo id

  • Id do carrinho deve ser passado na URI

  • Se o id não existir lançará um status 404

➤ [DELETE] deleteById()

http://localhost:8080/api/carrinhos/{id}
  • id do carrinho deve ser informado na URI

  • deleta um carrinho pelo id

  • se id não existir lançará um erro 404

➤ [POST] save()

http://localhost:8080/api/carrinhos/{idCliente}

{
"itens": [
         {
           "quantidade": 1,
            "game":{
                 "id": 1,
                 "nome": "Clash Royale"
                 "urlImagem": "http://image/linkFicticio/royale",
                 "descricao": "Destrua a torre do seu inimigo!",
 "preco": 20.0
            }
         },
         {
 "quantidade": 1,
            "game":{
                  "id": 3,
                  "nome": "Minecraft",            
                  "urlImagem": "http://image/linkFicticio/minecraft",
                  "descricao": "Crie um mundo e explore-o.",
                  "preco": 10.0,
            }
          }
]}

  • salva um carrinho de compras

  • id do cliente associado ao carrinho deve ser passado na URI

  • quantidade e game são obrigatórios

➤ [PUT] update()

http://localhost:8080/api/carrinhos/{idCarrinho}

{
"itens": [
         {
           "quantidade": 1,
            "game":{
                "id": 1,
                "nome": "Clash Royale"
                "urlImagem": "http://image/linkFicticio/royale",
                "descricao": "Destrua a torre do seu inimigo!",
                "preco": 20.0
            }
         }
]}

  • id do carrinho a ser atualizado deve ser passado na URI

  • quantidade e game são obrigatórios

  • Não passe um game não-salvo no banco de dados

You might also like...

There is no good reason to render the hotbar at 100+ fps

There is no good reason to render the hotbar at 100+ fps

FasterGUI Render the HUD and screens at a lower framerate to speed up what's really important: the worldrendering. Renders the HUD at a lower fixed fr

Dec 22, 2022

Rate limiting private REST APIs using Java Spring-boot, spring-security and bucket4j

Rate limiting REST APIs using Spring-security filter and Bucket4J Deployed Application (Swagger-ui on heroku) Inspired from: Baeldung Article Applicat

Jul 18, 2022

The Quotation Management application is a API REST created using Spring Boot framework.

The Quotation Management application is a API REST  created using Spring Boot framework.

✅ Quotation Management API - Done ✅ About • Features • Setup • Technologies • Author • License 💻 About The Quotation Management application is a API

Apr 29, 2022

Spring Boot REST API authentication best practices using JWT

 Spring Boot REST API authentication best practices using JWT

Spring Boot REST API authentication best practices using JWT Token based API authentication with Spring Security and JWT (JSON web Token) Overview Thi

Dec 22, 2022

Spring Boot Rest API unit test with Junit 5, Mockito, Maven

Spring Boot Rest API unit testing with Junit 5, Mockito, Maven Apply Spring Boot @WebMvcTest for Rest Controller Unit Test with JUnit 5 and Mockito. F

Dec 22, 2022

Web-based restaurant management system with spring boot and rest API for school final-year project.

Restaurant Management System Developing this for my school as first final year project. It shall be able to handle most of the challanges that encount

Mar 10, 2022

Spring-boot project using open-api, docker, maven, REST

library-service spring-boot project using open-api, docker, maven, REST I used docker to run the project, as well as open-api to generate basic GET an

Nov 27, 2022

This is simple REST API developed with Spring Boot which allows transactions on taboo cards.

Taboo Cards REST API with Spring Boot Summary: This is simple REST API developed with Spring Boot which allows transactions on taboo cards. Requiremen

Sep 16, 2022

该仓库中主要是 Spring Boot 的入门学习教程以及一些常用的 Spring Boot 实战项目教程,包括 Spring Boot 使用的各种示例代码,同时也包括一些实战项目的项目源码和效果展示,实战项目包括基本的 web 开发以及目前大家普遍使用的线上博客项目/企业大型商城系统/前后端分离实践项目等,摆脱各种 hello world 入门案例的束缚,真正的掌握 Spring Boot 开发。

该仓库中主要是 Spring Boot 的入门学习教程以及一些常用的 Spring Boot 实战项目教程,包括 Spring Boot 使用的各种示例代码,同时也包括一些实战项目的项目源码和效果展示,实战项目包括基本的 web 开发以及目前大家普遍使用的线上博客项目/企业大型商城系统/前后端分离实践项目等,摆脱各种 hello world 入门案例的束缚,真正的掌握 Spring Boot 开发。

Spring Boot Projects 该仓库中主要是 Spring Boot 的入门学习教程以及一些常用的 Spring Boot 实战项目教程,包括 Spring Boot 使用的各种示例代码,同时也包括一些实战项目的项目源码和效果展示,实战项目包括基本的 web 开发以及目前大家普遍使用的前

Dec 30, 2022
Owner
M4TH3US17
Matheus Washington | Manaus/AM | (92) 92702070 (WhatsApp)
M4TH3US17
Spring Boot Login and Registration example with MySQL, JWT, Rest Api - Spring Boot Spring Security Login example

Spring Boot Login example with Spring Security, MySQL and JWT Appropriate Flow for User Login and Registration with JWT Spring Boot Rest Api Architect

null 58 Jan 5, 2023
循序渐进,学习Spring Boot、Spring Boot & Shiro、Spring Batch、Spring Cloud、Spring Cloud Alibaba、Spring Security & Spring Security OAuth2,博客Spring系列源码:https://mrbird.cc

Spring 系列教程 该仓库为个人博客https://mrbird.cc中Spring系列源码,包含Spring Boot、Spring Boot & Shiro、Spring Cloud,Spring Boot & Spring Security & Spring Security OAuth2

mrbird 24.8k Jan 6, 2023
100+ Spring Boot Articles, Tutorials, Video tutorials, Projects, Guides, Source code examples etc

YouTube Channel - Spring Boot Tutorial Subscribe for future video and updates Spring Boot Tutorial on YouTube Newly published spring boot tutorials (2

Ramesh Fadatare 1.2k Jan 2, 2023
Spring JPA Many To Many example with Hibernate and Spring Boot CRUD Rest API - ManyToMany annotation

Spring JPA Many To Many example with Hibernate and Spring Boot CRUD Rest API - ManyToMany annotation

null 17 Dec 28, 2022
Spring REST service built with Spring initializr and Spring Data.

Spring REST Service Generated with start.spring.io, using Spring Data. Documented using Spring REST Docs. Spring Initializr - Generate new Spring Rest

null 1 Jan 28, 2022
Free and 100% open source Progressive Java Runtime for modern Java™ deployments supported by a leading OpenJDK contributor

BellSoft Liberica JDK is a build of OpenJDK that is tested and verified to be compliant with the Java SE specification using OpenJDK Technology Compat

null 195 Dec 22, 2022
See how simple it is to build a REST API with a database using Java and Spring Boot

Seu primeiro projeto Java Web no Spring Boot 2022 Veja como é simples construir uma API REST com banco de dados usando Java e Spring Boot Realização D

DevSuperior 74 Dec 26, 2022
Spring REST API for financial management, developed with Java 11, JWT for authentication, JUnit for unit testing and Oracle Database

control_financial Spring REST API for financial management, developed with Java 11, JWT for authentication, JUnit for unit testing and Oracle Database

Vinicius Cassaro 1 May 27, 2022
Warehouse management REST API with Java & Spring Boot

Spring Warehouse Spring Warehouse is a Java Spring Boot REST API that has the purpose of managing products and articles in your warehouse. This projec

Josep Bigorra 40 Dec 15, 2022
Official React Native client for FingerprintJS PRO. 100% accurate device identification for fraud detection.

FingerprintJS PRO React Native Official React Native module for 100% accurate device identification, created for the FingerprintJS Pro Server API. Thi

FingerprintJS 26 Nov 22, 2022