Giter VIP home page Giter VIP logo

api_final_yatube's Introduction

YaTube API

workflows

Project stack
  • Python 3.7
  • Django 2.2
  • Django REST Framework
  • Djoser
  • GitHub Actions

Описание

API для проекта "YaTube". Сайт "YaTube" - это онлайн-сервис для публикации, получения записей, комментирования записей других пльзователей и подписки на авторов.

Инструкция по запуску:

Клонируйте репозиторий:

git clone [email protected]:ThatCoderMan/foodgram-project-react.git

Установите и активируйте виртуальное окружение:

  • для MacOS:
    python3 -m venv venv
    
  • для Windows:
    python -m venv venv
    source venv/bin/activate
    source venv/Scripts/activate
    

Установите зависимости из файла requirements.txt:

pip install -r requirements.txt

Перейти в папку yatube_api/

cd yatube_api/

Примените миграции:

python manage.py migrate

В папке с файлом manage.py выполните команду для запуска локально:

python manage.py runserver

Документация к проекту доступна по адресу:

http://127.0.0.1:8000/redoc/

Примеры работы API

Создание, изменение, удаление публиакаций; добавление, изменение, удаление комментариев; получение списка подсписок и подписка на пользователей доступно только для авторизованных пользователей.

Редактировать, удалять публикации и комментарии может только автор публикации или комментария.

Получение публикаций

Пагинация при помощи параметров offset и limit

GET /api/v1/posts/

response: [{id: int; author: str; text: str; pub_date: str ; image: str binary; group: int}]

Создание публикации

POST /api/v1/posts/

body: {text: str; image: str binary; group: int}

Получение публикации

GET /api/v1/posts/{id}/

response: {id: int; author: str; text: str; pub_date: str ; image: str binary; group: int}

Обновление публикации

Полное обновление публикации

PUT /api/v1/posts/{id}/

body: {text: str; image: str binary; group: int}

Частичное обновление публикации

PATCH /api/v1/posts/{id}/

body: {text: str; image: str binary; group: int}

Удаление публикации

DEL /api/v1/posts/{id}/

Получение комментариев

GET /api/v1/posts/{post_id}/comments/

response: [{id: int; author: str; text: str, created: str ; post: int}]

Добавление комментария

POST /api/v1/posts/{post_id}/comments/

body: {text: str}

Получение комментария

GET /api/v1/posts/{post_id}/comments/{id}/

response: {id: int; author: str; text: str, created: str ; post: int}

Обновление комментария

PUT /api/v1/posts/{post_id}/comments/{id}/ PATCH /api/v1/posts/{post_id}/comments/{id}/

body: {text: str}

Удаление комментария

DEL /api/v1/posts/{post_id}/comments/{id}/

Список сообществ

GET /api/v1/groups/

response: [{id: int; title: str; slug: str; description: str}]

Информация о сообществе

GET /api/v1/groups/{id}/

response: {id: int; title: str; slug: str; description: str}

Подписоки на пользователей

поиск при помощи параметра search

GET /api/v1/follow/

response: [{user: str; following: str}]

Подписаться на пользователя

POST /api/v1/follow/

body: {following: str}

Получить JWT-токен

POST /api/v1/jwt/create/

body: {username: str; password: str} response: {refresh: str; access: str}

Обновить JWT-токен

POST /api/v1/jwt/refresh/

body: {refresh: str} response: {access: str}

Проверить JWT-токен

POST /api/v1/jwt/verify/

body: {token: str}

Автор проекта:

Artemii Berezin

api_final_yatube's People

Contributors

thatcoderman avatar

Watchers

 avatar

api_final_yatube's Issues

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.