Giter VIP home page Giter VIP logo

crud-rest-api_buala's Introduction

(CRUD REST API) Ivern Studios API Documentation

Introduction

Welcome to the Ivern Studios API documentation! This API provides functionality to manage the studio company information with user authentication, built with Flask and MySQL.

REST API

  • REST API stands for "Representational State Transfer Application Programming Interface".

  • It is an architectural style for an API that uses HTTP requests to access and use data, and exchange it securely over the internet. REST API is an a way for two computer systems to communicate.

  • For instance, when a developer requests YouTube API to fetch a user's object or a resource, the API will send back the state of that user, their name, subscribers, and videos or posts shared on YouTube. This is possible due to the API integration projects. This also applies to some other websites such as Twitter and Facebook.

  • It interacts with resources by using representations such as in JSON, XML, or HTML format.

  • REST API uses resources that are represented by URIs, and each of them can be identified by a unique URL.

  • REST APIs also have a uniform interface that simplifies the architecture, typically achieved by sticking to standard HTTP methods or the CRUD:

GET: Retrieve information from the server.

POST: Send data to the server to create or update a resource.

PUT: Update a resource on the server.

DELETE: Remove a resource from the server

  • In simple terms, this REST API is a set of rules or conventions for building/interacting with web services. It also relies on a stateless, client-server communication protocol like HTTP or the Hypertext Transfer Protocol.

Installation

  1. Create or Clone the Repository:

    git clone https://github.com/pavseh/CRUD-REST-API_Buala
  2. Navigate to the project directory:

    cd BUALA-FINALS-NEW
  3. Install all the required dependencies or libraries:

    pip install -r requirements.txt

    or can install them one by one:

    pip install Flask Flask-MySQLdb Flask-RESTful Flask-JWT-Extended
    pip install hmac

    This HMAC or Hash-based Message Authentication Code may be already inside the rest of the installed libraries. This module ensures that the data is safe to any attacks and safeguard its integerity. It can be only accessed and unlocked with the right secret key.

  4. Set up the MySQL database by executing the SQL Database I made for the program: ivernstudios.sql.

  5. Make sure that all the configurations of the SQL Database is already set up.

app.config["MYSQL_HOST"] = "localhost"
app.config["MYSQL_USER"] = "root"
app.config["MYSQL_PASSWORD"] = "password"  # I used 111004
app.config["MYSQL_DB"] = "name" # I used ivernstudios
app.config["MYSQL_CURSORCLASS"] = "DictCursor"
  1. Setting up your MySQL database:

    • Open a MySQL database named ivernstudios.
    • Update the database connection settings in api_buala.py with your MySQL username, password, host, and name of the database.
  2. Lastly, run the Flask App: (do not run the tester.py)

    python api_buala.py
  3. The application should now be running locally. Access it in your browser or Postman at http://localhost:5000.

Usage

  1. Run the Flask App:

    python or py api_buala.py
  2. The API will be accessible at http://localhost:5000.

Other Usage

Once you have the app running, you can now do the following actions:

  • Add an employee
  • View all employees
  • Update/Remove existing employee/s
  • Can view the employee in JSON/XML format (I used JSON for this one.)

API Usage

I used Postman for the CRUD or Create (Post), Read (Get), Update (Put), Delete (DELETE).

  • POST /add_employee: Create a new employee.
  • GET /employees: View all employees.
  • PUT /update_employee: Update an existing employee.
  • DELETE /delete_employee: Delete an employee.

Other Information

To authenticate, send a POST request to /auth with JSON containing username and password:

With Postman, you can go to the Auth Type > Bearer Token, then paste the token for authorization (This applies to PUT/UPDATE and DELETE) of the program.

Token

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcxNjUzNDA4NCwianRpIjoiZmMwZmNkZmUtY2U2OC00N2U4LWEwMzgtNWQ1MGU3MzM2ZTMyIiwidHlwZSI6ImFjY2VzcyIsInN1YiI6MSwibmJmIjoxNzE2NTM0MDg0LCJjc3JmIjoiNzVmYThhOWUtNTJlMi00M2YxLWJjYWMtZTJiZGNjZDk4NTRmIiwiZXhwIjoxNzE2NTM0OTg0fQ.oCFPq67v6dnOMLE2vDZgqKQSVldQsQeSp6OCnb4FIq8

Security Information

Username: admin
Password: buala

crud-rest-api_buala's People

Contributors

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