Coder Social home page Coder Social logo

java-cep-challenge's Introduction

RESTful API for CEP Data Retrieval

This project is a RESTful API built in Java that provides an endpoint to fetch data based on a given CEP (Brazilian postal code). The API will retrieve the following information:

  • Logradouro (Street address)
  • Bairro (Neighborhood)
  • Cidade (City)
  • Estado (State)
  • País (Country)
  • Código IBGE da cidade (City IBGE code, if available)
  • Código IBGE do estado (State IBGE code, if available)

Endpoint Details

GET /api/cep/{cep}

This endpoint accepts a CEP (Brazilian postal code) as a parameter and fetches the data from the first API that responds:

  1. ViaCEP API: https://viacep.com.br/
  2. ApiCEP API: https://apicep.com/api-de-consulta/
  3. BrasilAPI: https://brasilapi.com.br/docs#tag/CEP

The API will return the data from the first successful response.

Usage

To use the API, send a GET request to the endpoint /api/cep/{cep} with the desired CEP in the path parameter.

Example Request:

GET /api/cep/01001-000

Example Response:

{
  "logradouro": "Praça da Sé",
  "bairro": "",
  "cidade": "São Paulo",
  "estado": "SP",
  "país": "Brasil",
  "codigoIBGECidade": null,
  "codigoIBGEEstado": null
}

API Documentation

The API documentation is available at the following URL when the application is running:

http://localhost:8080/swagger-ui.html

You can use Swagger UI to explore the available endpoints, request/response formats, and also test the API directly from the web interface.

Contributing

Feel free to contribute to this project by submitting pull requests or reporting issues. Your contributions are greatly appreciated!

License

This project is licensed under the MIT License - see the LICENSE file for details.

java-cep-challenge's People

Contributors

obarg777 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.