Skip to content

ahmetozmtn/RESTFul-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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": "example@example.com",
            "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": "example@example.com",
          "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": "example@example.com",
            "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": "example@example.com",
            "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.

Releases

No releases published

Packages

No packages published

Languages