Coder Social home page Coder Social logo

restful-api's Introduction

RestFul API Example

Bu proje, Flask ve SQLAlchemy kullanılarak geliştirilmiş basit bir RESTful API örneği'dir.

Kurulum ve çalıştırma


Projeyi klonlama

git clone CLONE_URL

Proje klasörne girin

cd RESTFul-API

Gerekli bağımlılıkları yüklemek için

pip install -r requirements.txt

Projeyi çalıştırma

  • Linux & Mac OS X
python3 main.py
  • Windows
python main.py

Kullanım

Proje aşağıdaki endpointleri sağlamaktadır:

  • api/addData: Veritabanına yeni bir kayıt eklemek için POST isteği yapılır.
    • Örnek kullanım: api/addData/1
    • Uyarı!!! ; POST istediği atarken eklemek istediğiniz verilerin JSON formatında, isteğin Body kısmına ekleminiz gerekiyor.
      • Örnek;
        {
            "username": "username",
            "password": "password",
            "email": "[email protected]",
            "phone": "0555555555",
            "address": "example example",
            "city": "City",
            "state": "State",
            "product_name": "Product Name"
        }

  • api/deleteData/<int:id>: Belirtilen ID'ye sahip kaydı silmek için DELETE isteği yapılır.
    • Örnek kullanım : api/deleteData/1

  • api/getData: Tüm kayıtları getirmek için GET isteği yapılır.

  • api/allDelete: Tüm kayıtları silmek için DELETE isteği yapılır.

  • api/updateData/<int:id>: Belirtilen ID'ye sahip kaydı güncellemek için PUT isteği yapılır.
    • Örnek kullanım: api/updateData/1
    • Uyarı!!! ; PUT istediği atarken güncellemek istediğiniz verilerin JSON formatında isteğin Body kısmına ekleminiz gerekiyor
      • Örnek;
      {
          "username": "username",
          "password": "password",
          "email": "[email protected]",
          "phone": "0555555555",
          "address": "example example",
          "city": "City",
          "state": "State",
          "product_name": "Product Name"
      }

Veritabanı

Projede SQLAlchemy kullanılarak bir SQLite veritabanı kullanılmaktadır. Veritabanı şeması ve tablo yapısı için models.py dosyasına bakabilirsiniz.

Katkılar

Eğer projeye katkıda bulunmak isterseniz, lütfen bir Pull Requets oluşturun. Katkılarınızı bekliyoruz!

Lisans

Bu proje MIT lisansı altında lisanslanmıştır.


RESTful API Example

This project is a simple example of a RESTful API developed using Flask and SQLAlchemy.

Installation and Running


Clone the project

git clone CLONE_URL

Navigate to the project folder

cd RESTFul-API

Install the required dependencies

pip install -r requirements.txt

Run the project

  • Linux & Mac OS X
python3 main.py
  • Windows
python main.py

Usage

The project provides the following endpoints:

  • api/addData: Make a POST request to add a new record to the database.

    • Example usage: api/addData/1

    • Warning!!! ; When sending a POST request, you need to add the data you want to add in JSON format to the Body of the request.

      • Example;

        {
            "username": "username",
            "password": "password",
            "email": "[email protected]",
            "phone": "0555555555",
            "address": "example example",
            "city": "City",
            "state": "State",
            "product_name": "Product Name"
        }

  • api/deleteData/<int:id>: Make a DELETE request to delete a record with the specified ID.
    • Example usage : api/deleteData/1

  • api/getData: Make a GET request to retrieve all records.

  • api/allDelete: Make a DELETE request to delete all records.

  • api/updateData/<int:id>: Make a PUT request to update a record with the specified ID.

    • Example usage: api/updateData/1

    • Warning!!! ; When sending a PUT request, you need to add the data you want to update in JSON format to the Body of the request

      • Example;

        {
            "username": "username",
            "password": "password",
            "email": "[email protected]",
            "phone": "0555555555",
            "address": "example example",
            "city": "City",
            "state": "State",
            "product_name": "Product Name"
        }

Database

In the project, SQLAlchemy is used to use an SQLite database. You can refer to the models.py file for the database schema and table structure.

Contributions

If you would like to contribute to the project, please create a Pull Request. We welcome your contributions!

License

This project is licensed under the MIT license.

restful-api's People

Contributors

ahmetozmtn avatar

Stargazers

M. Ali Erdoğan avatar Nuray avatar Burak Aydemir avatar

Watchers

 avatar  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.