A REST API server built with Django REST framework for the Alumni of Bangladesh University of Professionals that allows its' users to:
- Register & Login
- Create/Update/Delete profile
- Update settings
- Create/Update/Delete/Like/Unlike blog posts
Make sure you have already installed python3 and git.
git clone https://github.com/hmsayem/alumni-api.git && cd alumni-api
pip install -r requirements.txt
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
The blog should be available at
localhost:8000
. You can login as an admin athttp://localhost:8000/admin
.
POST /api/account/register/
Request Body:
{
"first_name": "Hossain",
"last_name": "Mahmud",
"username": "hmsayem",
"email": "hmsayem@gmail.com",
"password": "changeit"
}
POST /api/account/login/
Request Body:
{
"username": "hmsayem",
"password": "changeit"
}
Login reqeust returns a token and an expiry as a json response. The token should be set as the authorization header.
GET /api/account/user/
GET /api/account/user/${user_id}/
PUT /api/account/user/${user_id}/
Request Body:
{
"username": "sayem",
"email": "sayem@gmail.com"
}
This request will update the username and email of the specified user. Server will deny the request if the specified user is not same as the logged in user.
GET /api/account/profile/
POST /api/account/profile/
Request Body:
{
"about": "Passionate about implementing new projects",
"faculty": "FST",
"department": "ICT",
"roll": 17511058,
"batch": 2017,
"passing_year": 2021
}
This request will create the above profile for the logged in user.
GET /api/account/profile/${user_id}/
PUT /api/account/profile/${user_id}/
Request Body:
{
"roll": 17511060,
"batch": 2018
}
This request will update the roll and batch of the specified user. Server will deny the request if the specified user is not same as the logged in user.
DELETE /api/account/profile/${user_id}/
Server will deny the request if the specified user is not same as the logged in user.
GET /api/account/job/
POST /api/account/job/
Request Body:
{
"title": "Software Engineer",
"company": "AppsCode Inc.",
"start_date": "2021-03-01"
}
This request will create the above job description for the logged in user.
GET /api/account/job/${user_id}/
PUT /api/account/job/${user_id}/
Request Body:
{
"start_date": "2021-04-01"
}
This request will update the start_date of the specified user. Server will deny the request if the specified user is not same as the logged in user.
DELETE /api/account/job/${user_id}/
Server will deny the request if the specified user is not same as the logged in user.
GET /api/account/social/
POST /api/account/social/
Request Body:
{
"facebook": "https://www.facebook.com/hm.sayem",
"linkedin": "https://www.linkedin.com/in/hmsayem",
"github": "https://github.com/hmsayem"
}
This request will create the above social links for the logged in user.
GET /api/account/social/${user_id}/
PUT /api/account/social/${user_id}/
Request Body:
{
"facebook": "https://www.facebook.com/sayem",
"linkedin": "https://www.linkedin.com/in/sayem",
}
This request will update the facebook and linked in links of the specified user. Server will deny the request if the specified user is not same as the logged in user.
DELETE /api/account/social/${user_id}/
Server will deny the request if the specified user is not same as the logged in user.
GET /api/blog/post/
POST /api/blog/post/
Request Body:
{
"title": "Blog Post 1",
"body": "<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using<strong> Lorem Ipsum</strong> is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>",
"category": "Dynamic Programming"
}
This request will create the above blog post. Server will set the logged in user as the author of this blog post.
GET /api/blog/post/${blog_id}/
PUT /api/blog/post/${blog_id}/
Request Body:
{
"title": "Blog Post 2"
}
This request will update the title of the specified blog post. Server will deny the request if the author of the blog post is not same as the logged in user.
DELETE /api/blog/post/${blog_id}/
Server will deny the request if the author of the blog post is not same as the logged in user.
PUT /api/blog/like/${blog_id}/
This request will add a like to the specified blog post. If the post is already liked by the logged in user, the request will remove the like from it.