Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Social Network REST API and Automated Bot

This project involves creating a simple REST API for a social network, accompanied by an automated bot that demonstrates the system's functionalities based on predefined rules.


📍How to install:

📮Connect to Postman:


1.1 Import `Postman Collections`folder into Postman

1.2 Set the environment settings `Social network.postman_environment`

1.3 The `Social Network.postman_collection` collection contains requests

🐳Connect to Docker Compose:


Create Your .env and set correct values look at .env.example

UP Docker-compose:

docker-compose -f docker/docker-compose.yml up --build

Login to the container console:

docker exec -it django_container bash

Create superuser:

python manage.py createsuperuser

🤖Automated bot(run docker before)

Set your data in bot config.json:

{
  "number_of_users": 15,
  "max_posts_per_user": 3,
  "max_likes_per_user": 10
}

Open remote docker bash:

docker run --rm bot_container bash 

Run Bot:

python bot.py

Endpoints

Authentication Endpoints

  • POST /api/token/: Log in and receive a JWT token.
  • POST /api/token/refresh/: Refresh the JWT token.

User Management Endpoints

  • POST /api/auth/users/: Create a new user.
  • GET /api/auth/users/me/: .
  • GET /api/user_activity/: Retrieve information about the user's activity, including the last login time and the timestamp of the last request made to the service

Posts Endpoints

  • GET /api/posts/: Retrieve a list of all posts.
  • POST /api/posts/: Create a new post.
  • POST /api/posts/{{last_post}}/like/: Like a specific post.
  • POST /api/posts/{{last_post}}/unlike/: Unlike a previously liked post.
  • GET /api/analytics/?date_from=2022-01-01&date_to=2024-12-31: Retrieve analytics data for the number of likes aggregated by day within the specified date range.

About

No description or website provided.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages