{"id":742,"date":"2016-04-25T06:10:41","date_gmt":"2016-04-25T09:10:41","guid":{"rendered":"https:\/\/www.semeru.com.br\/blog\/?p=742"},"modified":"2022-12-21T10:59:35","modified_gmt":"2022-12-21T13:59:35","slug":"criando-o-primeiro-endpoint-rest-com-springboot","status":"publish","type":"post","link":"https:\/\/www.semeru.com.br\/blog\/criando-o-primeiro-endpoint-rest-com-springboot\/","title":{"rendered":"Criando o primeiro endpoint REST com SpringBoot"},"content":{"rendered":"<p>Neste post daremos continuidade a uma s\u00e9rie de postagens sobre <strong>Web-Services<\/strong> divididos entre conceitos te\u00f3ricos e praticos. Nos 3 primeiros posts focou-se em teoria com um sobre <a href=\"https:\/\/www.semeru.com.br\/blog\/web-services\/\">Web Services<\/a>, outro sobre <a href=\"https:\/\/www.semeru.com.br\/blog\/restful-web-services\/\">RESTful Web Services<\/a> e mais um sobre os <a href=\"https:\/\/www.semeru.com.br\/blog\/http-status-codes-em-servicos-rest\/\">HTTP Status Codes<\/a> mais comuns. Este post por sua vez complementa o que foi desenvolvido no post <a href=\"https:\/\/www.semeru.com.br\/blog\/do-zero-ao-rest-em-5-minutos-com-springboot\/\">Do zero ao REST em 5 minutos com SpringBoot<\/a>. Ent\u00e3o antes de come\u00e7ar veja o post anterior ou baixe o c\u00f3digo e vamos entender na pr\u00e1tica como funcionam os <strong>verbos REST<\/strong>.<\/p>\n<p>Agora faremos algumas altera\u00e7\u00f5es no projeto desenvolvido no post anterior. Para come\u00e7ar crie os seguintes pacotes <strong>br.com.erudio.models<\/strong>, <strong>br.com.erudio.services<\/strong>, <strong>br.com.erudio.services.implementations<\/strong> e <strong>br.com.erudio.web.controllers<\/strong>. Depois mova a classe <strong>Greeting<\/strong> para o pacote <strong>br.com.erudio.models<\/strong> e a classe <strong>GreetingController<\/strong> para o pacote <strong>br.com.erudio.web.controllers<\/strong>. A estrutura de pacotes deve ficar similar a imagem abaixo.<\/p>\n<p><a href=\"https:\/\/www.semeru.com.br\/blog\/criando-o-primeiro-endpoint-rest-com-springboot\/postagem_2_0\/\" rel=\"attachment wp-att-803\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-803\" src=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_0.png\" alt=\"postagem_2_0\" width=\"469\" height=\"383\" srcset=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_0.png 469w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_0-300x245.png 300w\" sizes=\"(max-width: 469px) 100vw, 469px\" \/><\/a><\/p>\n<p>Feito isto crie uma classe chamada <strong>Person<\/strong>, no pacote <strong>br.com.erudio.models<\/strong>, com as informa\u00e7\u00f5es que ser\u00e3o representadas pelo nosso <strong>endpoint REST<\/strong>.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\npackage br.com.erudio.models;\n\nimport java.io.Serializable;\n\nimport com.fasterxml.jackson.annotation.JsonIgnoreProperties;\n\n@JsonIgnoreProperties(ignoreUnknown = true)\npublic class Person implements Serializable{\n\n    private static final long serialVersionUID = 1L;\n\n    private Long id;\n    private String firstName;\n    private String lastName;\n    private String address;\n\n    public Long getId() {\n        return id;\n    }\n\n    public void setId(Long id) {\n        this.id = id;\n    }\n\n    public String getFirstName() {\n        return firstName;\n    }\n\n    public void setFirstName(String firstName) {\n        this.firstName = firstName;\n    }\n\n    public String getLastName() {\n        return lastName;\n    }\n\n    public void setLastName(String lastName) {\n        this.lastName = lastName;\n    }\n\n    public String getAddress() {\n        return address;\n    }\n\n    public void setAddress(String address) {\n        this.address = address;\n    }\n}\n\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Feito isto crie uma <strong>interface<\/strong> com o nome <strong>PersonService<\/strong> no pacote <strong>br.com.erudio.models<\/strong>.<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\npackage br.com.erudio.services;\n\nimport java.util.List;\n\nimport br.com.erudio.models.Person;\n\npublic interface PersonService {\n\n    Person create(final Person person);\n    Person findById(final String personId);\n    List&lt;person&gt; findAll();\n    Person update(Person person);\n    void delete(final String personId);\n\n}\n<\/pre>\n<p>Agora vamos criar a implementa\u00e7\u00e3o para a <strong>interface PersonService<\/strong>. No pacote <strong>br.com.erudio.services.implementations<\/strong> crie a classe <strong>PersonServiceImpl<\/strong> que implementa a interface que acabamos de criar.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\npackage br.com.erudio.services.implementations;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.atomic.AtomicLong;\n\nimport org.springframework.stereotype.Service;\n\nimport br.com.erudio.models.Person;\nimport br.com.erudio.services.PersonService;\n\n@Service\npublic class PersonServiceImpl implements PersonService {\n\n\t\/\/ Contador respons\u00e1vel por gerar um fake ID j\u00e1 que n\u00e3o estamos\n\t\/\/ acessando nenhum banco de dados\n    private final AtomicLong counter = new AtomicLong();\n\n\t\/\/ Metodo respons\u00e1vel por criar uma nova pessoa\n\t\/\/ Se tiv\u00e9ssemos um banco de dados esse seria o\n\t\/\/ momento de persistir os dados\n    @Override\n    public Person create(Person person) {\n        return person;\n    }\n\n\t\/\/ M\u00e9todo respons\u00e1vel por retornar uma pessoa\n\t\/\/ como n\u00e3o acessamos nenhuma base de dados\n\t\/\/ estamos retornando um mock\n    @Override\n    public Person findById(String personId) {\n        Person person = new Person();\n        person.setId(counter.incrementAndGet());\n        person.setFirstName(&quot;Leandro&quot;);\n        person.setLastName(&quot;Costa&quot;);\n        person.setAddress(&quot;Uberl\u00e2ndia - Minas Gerais - Brasil&quot;);\n        return person;\n    }\n\n\t\/\/ M\u00e9todo respons\u00e1vel por retornar todas as pessoas\n\t\/\/ mais uma vez essas informa\u00e7\u00f5es s\u00e3o mocks\n    @Override\n    public List&lt;person&gt; findAll() {\n        ArrayList&lt;person&gt; persons = new ArrayList&amp;lt;&amp;gt;();\n        for (int i = 0; i &amp;lt; 8; i++) {\n            Person person = mockPerson(i);\n            persons.add(person);\n        }\n        return persons;\n    }\n\n\t\/\/ M\u00e9todo respons\u00e1vel por atualizar uma pessoa\n\t\/\/ por ser mock retornamos a mesma informa\u00e7\u00e3o passada\n    @Override\n    public Person update(Person person) {\n    \treturn person;\n    }\n\n\t\/\/ M\u00e9todo respons\u00e1vel por deletar\n\t\/\/ uma pessoa a partir de um ID\n    @Override\n    public void delete(String personId) {\n\n    }\n\n\t\/\/ M\u00e9todo respons\u00e1vel por mockar uma pessoa\n    private Person mockPerson(int i) {\n        Person person = new Person();\n        person.setId(counter.incrementAndGet());\n        person.setFirstName(&quot;Person Name &quot; + i);\n        person.setLastName(&quot;Last Name &quot; + i);\n        person.setAddress(&quot;Some Address in Brasil &quot; + i);\n        return person;\n    }\n}\n\n<\/pre>\n<p>Por fim crie a classe <strong>PersonController<\/strong>, respons\u00e1vel por expor o <strong>endpoint de pessoas<\/strong>, no pacote <strong>br.com.erudio.web.controllers<\/strong>.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\npackage br.com.erudio.web.controllers;\n\nimport java.util.List;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.http.HttpStatus;\nimport org.springframework.http.MediaType;\nimport org.springframework.web.bind.annotation.PathVariable;\nimport org.springframework.web.bind.annotation.RequestBody;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.RequestMethod;\nimport org.springframework.web.bind.annotation.ResponseStatus;\nimport org.springframework.web.bind.annotation.RestController;\n\nimport br.com.erudio.models.Person;\nimport br.com.erudio.services.PersonService;\n\n@RestController\n\/\/Mapeia as requisi\u00e7\u00f5es de localhost:8080\/person\/\n@RequestMapping(&quot;\/person\/&quot;)\npublic class PersonController {\n\n    @Autowired\n    private PersonService personService;\n\n    @ResponseStatus(HttpStatus.OK) \/\/Por padr\u00e3o responde com o status code 200 success\n    @RequestMapping(value = &quot;\/{personId}&quot;,\n\t\t\/\/Mapeia as requisi\u00e7\u00f5es GET para localhost:8080\/person\/\n\t\t\/\/recebendo um ID como @PathVariable\n\t\tmethod = RequestMethod.GET,\n\t\tproduces = MediaType.APPLICATION_JSON_VALUE)\n\t\t\/\/ Produz JSON como retorno\n    public Person get(@PathVariable(value = &quot;personId&quot;) String personId){\n        return personService.findById(personId);\n    }\n\n    @ResponseStatus(HttpStatus.OK)\n\t\/\/Por padr\u00e3o responde com o status code 200 success\n    @RequestMapping(value = &quot;\/findAll&quot;,\n\t\t\/\/Mapeia as requisi\u00e7\u00f5es GET para localhost:8080\/person\/findAll\n\t\tmethod = RequestMethod.GET,\n\t\tproduces = MediaType.APPLICATION_JSON_VALUE)\n\t\t\/\/ Produz JSON como retorno\n    public List&lt;person&gt; findAll(){\n        return personService.findAll();\n    }\n\n    @ResponseStatus(HttpStatus.OK)\n\t\/\/Por padr\u00e3o responde com o status code 200 success\n    @RequestMapping(method = RequestMethod.PUT,\n\t\/\/Mapeia as requisi\u00e7\u00f5es PUT para localhost:8080\/person\/\n\t\tconsumes = MediaType.APPLICATION_JSON_VALUE,\n\t\t\/\/ Consome JSON enviado no corpo da requisi\u00e7\u00e3o\n\t\tproduces = MediaType.APPLICATION_JSON_VALUE)\n\t\t\/\/ Produz JSON como retorno\n    public Person create(@RequestBody Person person){\n        return personService.create(person);\n    }\n\n    @ResponseStatus(HttpStatus.OK)\n\t\/\/Por padr\u00e3o responde com o status code 200 success\n    @RequestMapping(method = RequestMethod.POST,\n\t\/\/Mapeia as requisi\u00e7\u00f5es POST para localhost:8080\/person\/\n\t\tconsumes = MediaType.APPLICATION_JSON_VALUE)\n\t\t\/\/ Consome JSON enviado no corpo da requisi\u00e7\u00e3o\n    public Person update(@RequestBody Person person){\n        return personService.update(person);\n    }\n\n    @ResponseStatus(HttpStatus.OK)\n\t\/\/Por padr\u00e3o responde com o status code 200 success\n    @RequestMapping(value = &quot;\/{personId}&quot;,\n\t\tmethod = RequestMethod.DELETE)\n\t\t\/\/Mapeia as requisi\u00e7\u00f5es DELETE para localhost:8080\/person\/\n\t\t\/\/recebendo um ID como @PathVariable\n    public void delete(@PathVariable(value = &quot;personId&quot;) String personId){\n        personService.delete(personId);\n    }\n}\n<\/pre>\n<p>Agora que terminamos nossa codifica\u00e7\u00e3o acesse a classe <strong>Application<\/strong> e inicie a aplica\u00e7\u00e3o como no post anterior. Para testar nosso endpoint e cada uma de suas opera\u00e7\u00f5es usaremos o plugin do Chrome <a href=\"https:\/\/chrome.google.com\/webstore\/detail\/postman\/fhbjgbiflinjbdggehcddcbncdddomop\">Postman<\/a>.<\/p>\n<p>Primeiro faremos uma requisi\u00e7\u00e3o do tipo <strong>GET<\/strong> chamando a opera\u00e7\u00e3o <strong>findAll<\/strong> para o recurso <strong>localhost:8080\/person\/findAll<\/strong>. Como se pode ver na imagem abaixo obtemos como resposta um <strong>JSON<\/strong> com um array de pessoas.<\/p>\n<p><a href=\"https:\/\/www.semeru.com.br\/blog\/criando-o-primeiro-endpoint-rest-com-springboot\/postagem_2_2\/\" rel=\"attachment wp-att-744\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-744\" src=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_2-1024x574.png\" alt=\"postagem_2_2\" width=\"815\" height=\"457\" srcset=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_2-1024x574.png 1024w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_2-300x168.png 300w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_2-768x431.png 768w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_2.png 1767w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><\/a><\/p>\n<p>Agora faremos uma requisi\u00e7\u00e3o do tipo <strong>GET<\/strong> chamando a opera\u00e7\u00e3o <strong>localhost:8080\/person\/1<\/strong> passando como <strong>@PathVariable<\/strong> o ID da pessoa que desejamos recuperar. Da mesma forma que na requisi\u00e7\u00e3o anterior recebemos como resposta um <strong>JSON<\/strong> com 1 objeto pessoa.<\/p>\n<p><a href=\"https:\/\/www.semeru.com.br\/blog\/criando-o-primeiro-endpoint-rest-com-springboot\/postagem_2_1-2\/\" rel=\"attachment wp-att-750\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-750\" src=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_1-1-1024x390.png\" alt=\"postagem_2_1\" width=\"815\" height=\"310\" srcset=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_1-1-1024x390.png 1024w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_1-1-300x114.png 300w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_1-1-768x292.png 768w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_1-1.png 1911w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><\/a><\/p>\n<p>Agora faremos uma requisi\u00e7\u00e3o do tipo <strong>POST<\/strong> <strong>(esse \u00e9 o verbo REST usado para persistir informa\u00e7\u00f5es)<\/strong> chamando a opera\u00e7\u00e3o <strong>localhost:8080\/person\/<\/strong> passando como par\u00e2metro um <strong>JSON<\/strong> com um objeto pessoa no corpo da requisi\u00e7\u00e3o. Para isso no <strong>Postman<\/strong> precisamos setar o tipo de requisi\u00e7\u00e3o como <strong>POST<\/strong>, na<strong> aba Body<\/strong> definimos o <strong>JSON<\/strong> que representa o objeto pessoa a ser gravado, <strong>selecionamos a op\u00e7\u00e3o raw<\/strong>, <strong>definimos a op\u00e7\u00e3o JSON(application\/json)<\/strong> e por fim executamos a request atrav\u00e9s do bot\u00e3o send.<\/p>\n<p><a href=\"https:\/\/www.semeru.com.br\/blog\/criando-o-primeiro-endpoint-rest-com-springboot\/postagem_2_3\/\" rel=\"attachment wp-att-745\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-745\" src=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_3.png\" alt=\"postagem_2_3\" width=\"815\" height=\"320\"><\/a><\/p>\n<p>Na imagem abaixo podemos ver o body da response retornada com um ID definido pela aplica\u00e7\u00e3o.<\/p>\n<p><a href=\"https:\/\/www.semeru.com.br\/blog\/criando-o-primeiro-endpoint-rest-com-springboot\/postagem_2_4\/\" rel=\"attachment wp-att-746\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-746\" src=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_4.png\" alt=\"postagem_2_4\" width=\"815\" height=\"202\" srcset=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_4.png 1894w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_4-300x74.png 300w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_4-768x191.png 768w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_4-1024x254.png 1024w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><\/a><\/p>\n<p>Agora faremos uma requisi\u00e7\u00e3o do tipo <strong>PUT (esse \u00e9 o verbo REST usado para atualizar informa\u00e7\u00f5es)<\/strong> chamando a opera\u00e7\u00e3o <strong>localhost:8080\/person\/<\/strong> passando como par\u00e2metro um <strong>JSON<\/strong> com um objeto pessoa no corpo da requisi\u00e7\u00e3o. Lembrando que essa representa\u00e7\u00e3o de pessoa deve ter um ID que ser\u00e1 usado pra localizar e atualizar um recurso na base. Para isso no <strong>Postman<\/strong> precisamos setar informa\u00e7\u00f5es similares ao post a unica diferen\u00e7a \u00e9 que o tipo de requisi\u00e7\u00e3o deve ser o <strong>PUT<\/strong>.<\/p>\n<p><a href=\"https:\/\/www.semeru.com.br\/blog\/criando-o-primeiro-endpoint-rest-com-springboot\/postagem_2_5\/\" rel=\"attachment wp-att-747\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-747\" src=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_5.png\" alt=\"postagem_2_5\" width=\"815\" height=\"198\" srcset=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_5.png 1881w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_5-300x73.png 300w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_5-768x187.png 768w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_5-1024x250.png 1024w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><\/a><\/p>\n<p>Como se pode ver na imagem abaixo o <strong>body da response retorna o nosso objeto JSON<\/strong> com as altera\u00e7\u00f5es.<\/p>\n<p><a href=\"https:\/\/www.semeru.com.br\/blog\/criando-o-primeiro-endpoint-rest-com-springboot\/postagem_2_6\/\" rel=\"attachment wp-att-748\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-full wp-image-748\" src=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_6.png\" alt=\"postagem_2_6\" width=\"815\" height=\"221\" srcset=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_6.png 1890w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_6-300x81.png 300w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_6-768x208.png 768w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_6-1024x278.png 1024w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><\/a><\/p>\n<p>Por fim faremos uma requisi\u00e7\u00e3o do tipo <strong>DELETE (verbo REST usado excluir informa\u00e7\u00f5es)<\/strong> chamando a opera\u00e7\u00e3o <strong>localhost:8080\/person\/1<\/strong> passando como <strong>@PathVariable<\/strong> o ID da pessoa que desejamos remover da base. Esse tipo de requisi\u00e7\u00e3o <strong>retorna como resposta um body vazio e um StatusCode 200<\/strong> caso a opera\u00e7\u00e3o seja executada com sucesso os StatusCode <strong>204 (no content)<\/strong>, <strong>401 (Unauthorized)<\/strong>, <strong>403 (forbiden)<\/strong>, <strong>404 (not found)<\/strong> ou <strong>500 (internal server error)<\/strong> podem ser retornados.<\/p>\n<p><a href=\"https:\/\/www.semeru.com.br\/blog\/criando-o-primeiro-endpoint-rest-com-springboot\/postagem_2_7\/\" rel=\"attachment wp-att-749\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter size-large wp-image-749\" src=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_7-1024x307.png\" alt=\"postagem_2_7\" width=\"815\" height=\"243\" srcset=\"https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_7-1024x307.png 1024w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_7-300x90.png 300w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_7-768x230.png 768w, https:\/\/www.semeru.com.br\/blog\/wp-content\/uploads\/2016\/04\/postagem_2_7.png 1884w\" sizes=\"(max-width: 815px) 100vw, 815px\" \/><\/a><\/p>\n<p>Dessa forma abordamos os 4 verbos principais do <strong>HTTP<\/strong> usados em aplica\u00e7\u00f5es <strong>REST<\/strong>. Lembrando que voc\u00ea pode <a href=\"https:\/\/github.com\/leandrocgsi\/simple-rest-example-verbs\/archive\/master.zip\">baixar o c\u00f3digo aqui<\/a> e descompactar o arquivo zip e importar n\u00e3o sua IDE de preferencia ou clonar usando Git:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ngit clone https:\/\/github.com\/leandrocgsi\/simple-rest-example-verbs.git\n<\/pre>\n<p>Continue ligado no blog, por que no pr\u00f3ximo post iremos documentar a nossa <strong>API<\/strong> com o framewrok <strong>Swagger<\/strong>. E claro a abordagem nesses posts tamb\u00e9m ser\u00e1 totalmente m\u00e3o na massa. \u00c9 isso a\u00ed bons estudos.<\/p>\n<h2>Treinamentos relacionados com este post<\/h2>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_rest_spring_java\" target=\"_blank\" rel=\"noopener\"><\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;\" title=\"REST API's RESTFul do 0 \u00e0  AWS com Spring Boot 3, Java e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/07-rest-spring-java.png\"><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_microservices_java\" target=\"_blank\" rel=\"noopener\"><br \/>\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Microservices do 0 com Spring Cloud, Spring Boot e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/14-microservices-java.png\"><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_rest_spring_kotlin\" target=\"_blank\" rel=\"noopener\"><br \/>\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"REST API's RESTFul do 0 \u00e0 AWS com Spring Boot 3, Kotlin e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/18-rest-spring-kotlin.png\"><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_ms_kotlin\" target=\"_blank\" rel=\"noopener\"><br \/>\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Microsservi\u00e7os do 0 com Spring Cloud, Kotlin e Docker\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/22-ms-kotlin.png\"><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_docker\" target=\"_blank\" rel=\"noopener\"><br \/>\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Docker do 0 \u00e0 Maestria: Cont\u00eaineres Desmistificados mais 3 B\u00d4NUS\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/09-docker.png\"><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_docker_para_aws\" target=\"_blank\" rel=\"noopener\"><br \/>\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Docker para Amazon AWS Implante Apps Java e .NET com Travis CI\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/10-docker-to-aws.png\"><br \/>\n<\/a><\/p>\n<p><a href=\"https:\/\/pub.erudio.com.br\/kr\/blog_kotlin\" target=\"_blank\" rel=\"noopener\"><br \/>\n        <img decoding=\"async\" style=\"max-width: 100%;\" title=\"Kotlin para DEVs Java: Aprenda a Linguagem Padr\u00e3o do Android\" src=\"https:\/\/raw.githubusercontent.com\/leandrocgsi\/blog-images\/main\/20-kotlin.png\"><br \/>\n<\/a><\/p>\n<\/person><\/person><\/person><\/person>\n<div align=\"right\"><div class=\"sharexyWidgetNoindexUniqueClassName\"><div id=\"shr_37535802\"><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Neste post daremos continuidade a uma s\u00e9rie de postagens sobre Web-Services divididos entre conceitos te\u00f3ricos e praticos. Nos 3 primeiros posts focou-se em teoria com um sobre Web Services, outro sobre RESTful Web Services e mais um sobre os HTTP Status Codes mais comuns. Este post por sua vez complementa o que foi desenvolvido no [&#8230;]<\/p>\n<div align=\"right\">\n<div class=\"sharexyWidgetNoindexUniqueClassName\">\n<div id=\"shr_37535802\"><\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[117,116,63,208,115,105],"tags":[205,204,209,203,210],"_links":{"self":[{"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/posts\/742"}],"collection":[{"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/comments?post=742"}],"version-history":[{"count":30,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/posts\/742\/revisions"}],"predecessor-version":[{"id":1521,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/posts\/742\/revisions\/1521"}],"wp:attachment":[{"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/media?parent=742"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/categories?post=742"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.semeru.com.br\/blog\/wp-json\/wp\/v2\/tags?post=742"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}