Skip to content

CRUD API for managing pet information, developed with Python and Flask. The application allows for adding, listing, updating, and deleting pet records through a simple and efficient REST interface.

Notifications You must be signed in to change notification settings

dgirotto0/api-crud-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Pet CRUD API 🐾

This is a sample CRUD (Create, Read, Update, Delete) application developed in Python using the Flask framework. The API allows managing pet information, such as adding, listing, updating, and deleting data.

Features πŸš€

  • Add a Pet: Add new pets to the system.
  • List All Pets: Get a complete list of registered pets.
  • Update Pet Information: Update data for a specific pet by ID.
  • Delete a Pet: Remove a pet from the system using its ID.

Technologies Used πŸ› οΈ

  • Python - Main programming language.
  • Flask - Framework for building the API.
  • JSON - For data exchange between client and server.

How to Run the Project πŸ–₯️

  1. Clone the repository:
git clone https://github.com/dgirotto0/api-crud-python.git
  1. Access the project directory:
cd api-crud-python
  1. Install the required dependencies: Make sure Flask is installed. If not, install it with:
pip install flask
  1. Start the application:
python pet.py

Access the API via browser or tools like Postman:

http://127.0.0.1:5000

API Endpoints πŸ›£οΈ

Add a Pet

  • Route: /adicionar_pet
  • Method: POST
  • Description: Adds a new pet.
  • JSON Example:
  {
    "nome": "Rex",
    "tipo": "Cachorro",
    "idade": 3
  }

List Pets

  • Route: /listar_pets
  • Method: GET
  • Description: Returns all registered pets.

Uptade a Pet

  • Route: /atualizar_pet/<id>
  • Method: PUT
  • Description: Updates information for a specific pet.
  • JSON Example:
    {
      "nome": "Rex",
      "tipo": "Cachorro",
      "idade": 4
    }

Delete a Pet

  • Route: /excluir_pet/<id>
  • Method: DELETE
  • Description: Removes a pet by ID.

Code Structure πŸ—‚οΈ

The code is simple and organized in a single class containing the API routes. It uses an in-memory list to store data, ideal for demonstration purposes.

Lisense πŸ“œ

This project is licensed under the MIT License. See the LICENSE file for more details.

About

CRUD API for managing pet information, developed with Python and Flask. The application allows for adding, listing, updating, and deleting pet records through a simple and efficient REST interface.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages