Giter Club home page Giter Club logo

restapi's Introduction

RestApi

Using Rest Api via Python

REST API REST (REpresentational State Transfer) is an architectural style, and an approach to communications that is often used in the development of Web services. The use of REST is often preferred over the more heavyweight SOAP (Simple Object Access Protocol) style because REST does not leverage as much bandwidth, which makes it a better fit for use over the Internet. The SOAP approach requires writing or using a provided server program (to serve data) and a client program (to request data)

I have used GET option of RestApi for fetching data from database file(chinook.db),You can explore restapi by using PUT,POST,DELETE options of RestApi.

PACKAGES INSTALLED IN PYTHON

  1. Flask
  2. Flask-SQLAlchemy
  3. Flask-Restful
  4. SQlite3
  5. Jsonify

INSTALLATION

Considering Python is installed and configured, type- pip install flask flask-jsonpify flask-sqlalchemy flask-restful jsonify SQlite3

DATABASE

Chinook.db file is provided.You can check file using command "sqlite3 chinook.db". This command will connect you to the database for usage of it in program. I have taken this database file from http://www.sqlitetutorial.net/sqlite-sample-database website.

PYTHON CODE

server.py file is provided. Just Execute it using command "python server.py".This will create 3 routes in your browser-

Route 1 -->http://127.0.0.1:5002/employees This will show the employees ID of employees.

Route 2 -->http://127.0.0.1:5002/tracks This will show tracking details.

Route 3 -->http://127.0.0.1:5002/employees/8 This will show details of employee whose employee Id is = 8.

The format of data you will be getting in browser will json.

ABOUT

This is my First Github commit so please just let me know if there is any flaw, feel free to question and ask anything regarding this project. I have refered to https://impythonist.wordpress.com/2015/07/12/build-an-api-under-30-lines-of-code-with-python-and-flask blog for this,special thanks to it.

restapi's People

Contributors

kushell avatar

Stargazers

ik5 avatar GAURAV avatar

Watchers

James Cloos 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.