yemlihaoner / PythonRestAPI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About The Project

This Python Rest API aims to satisfy the requirements listed in a list of requirements defined under a case study PDF. Basicly the rest api has to:

  • Run an endpoint that operates CRUD operations for authors
  • Run an endpoint that operates CRUD operations for categories
  • Run an endpoint that operates CRUD operations for blogs

Built With

This project is built on Microsoft Visual Studio Code.

Prerequisites

Before continue, make sure you installed docker on your machine. To download docker click here. To run integration tests, it is highly recommended to install dotnet on your machine.

Installation and Docker Run

Open the terminal(cmd) and write each line to run program on docker

  1. Clone the repo
    git clone https://github.com/yemlihaoner/PythonRestAPI.git
  2. Change repository to run endpoints on docker
    cd ./PythonRestAPI
  3. Run docker-compose to activate webapi and database. If error occures related to db generation, Stop docker by CTRL+C and re-run command.
    docker-compose up

Warning

In order to upload files to cloud, you will need to set a .env file with required information:

  • CLOUD_NAME='cloud_name'
  • API_KEY='api_key'
  • API_SECRET='api_secret'

In this project, @cloudinary is used in order to save files in cloud. If you dont have an account click the @link and register for free to access api keys.

How to send request

After running the program on the docker, you can use api from http://localhost:80. Available api endpoints:

For Author:

{
    "first_name": "name",
    "last_name": "last name"
}

For Category:

{
    "name":"name",
    "description":"description"
}

For Blog:

Key Value
title string(40)
content string(200)
image - select file -
tags string(200)
category integer
author integer

Output format for Blog:

[
    {
        "author": 1,
        "category": 1,
        "content": "12",
        "date_created": "Sun, 21 Nov 2021 19:42:53 GMT",
        "id": 1,
        "image": "https://res.cloudinary.com/yemliha/image/upload/v1637523773/lk278b28ejbp9pjjtspk.png",
        "tags": "22-23",
        "title": "12"
    }
]

Contact

Ahmet Yemliha Öner - @github - @website - a.yemlihaoner@gmail.com

Project Link: https://github.com/yemlihaoner/PythonRestAPI

(back to top)

About


Languages

Language:Python 97.4%Language:Dockerfile 2.6%