Skip to content

sumitis14/PizzaAPI

Repository files navigation

PizzaAPI

A dummy web API for a facilitating pizza delivery

URL Link

https://pizzapi.herokuapp.com/

Installation

Flask
Flask-RESTful
Flask-JWT
Flask-SQLAlchemy

Description

Basic Pizza API

Tools used:

  1. Python 3.6.3
  2. Flask, Flask-RESTful, Flask SQLAlchemy
  3. SQLite
  4. Heroku to host the site
  5. POSTMAN to test the API

Implementation and Running steps:

This project is implemented using Python3, Flask, POSTMAN, SQLAlchemy. Perform following steps to get and post requests.

  1. Install Postman
https://www.getpostman.com/
  1. Open the link where API is hosted
https://pizzapi.herokuapp.com/
  1. Open Postman and manage environment variables. Following is an example:

env test

  1. Declare endpoints to perform operation like below:
end points

end text

  1. Set environment variable in endpoints.
    {{url}} in GET/POST/DELETE/ endpoints
    {{jwt_token}} in Headers:
        a) Select Authorization
        b) JWT {{jwt_token}}

set test

  1. For GET and Post an item:
Use Get endpoint:
    -- type {{url}}/item/<id>

Use Post\put endpoint
    -- type {{url}}/item/<name of string>
    -- in Body field add like below:
    {
	    "timeOpen" : 10,
	    "timeClose" : 20
    }

get test

  1. Authorization for POST and DELETE
- To delete an item by name. User need to register first.
- Then create POST /auth endpoint. POST following sample code to authenticate a registered user:
    {
        "username" : "username_with_which_you_registered",
        "password" : "password_with_which_you_registered"
    }
- After doing auth successfully. JWT token will be generated. Use that for deleting an item:
    --Select Authorization as Key in header, and Add JWT {{JWT}} in value. 

End of document.

About

A dummy web API

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published