[git clone] (https://github.com/razaullah123/Ropstam.git)
cd Ropstam
pip install virtualenv
python3 -m venv virtual_environment_name
source virtual_environment_name/bin/activate
pip install -r requirements.txt
python manage.py runserver
(http://127.0.0.1:8000/auth/registration/)
POST
username
email
{
"result": "User Register Successfully",
"username": "mujeeb"
}
After Successful registration an email will be sent to the user mentioned email with a randomly generated password
( http://127.0.0.1:8000/auth/sign-in/)
POST
username
email
password Sent to the user email
{
"result": "User login Successfully",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InJhemFAeW9wbWFpbC5jb20iLCJ1c2VybmFtZSI6InJhemF1bGxhaCIsImlhdCI6MTY1NzMwNzgwNH0.dGOcISYWPIMskh0nhTigRtrJsawoaPwabFWo0m9Tgik",
"users": [
{
"id": 1,
"username": "razaullah",
"email": "raza@yopmail.com"
}
]
}
(http://127.0.0.1:8000/vehicles/category/)
POST
title
token
{ "title": "Bus" }
(http://127.0.0.1:8000/vehicles/category/1/)
PATCH
title
token
{ "title": "Cars" }
(http://127.0.0.1:8000/vehicles/category/)
GET
token
{ "count": 3, "next": null, "previous": null, "results": [ { "title": "Bus" }, { "title": "Sedan" }, { "title": "SUV" } ] }
(http://127.0.0.1:8000/vehicles/category/1/)
DELETE
token Note: Before deleting a category we should delete the cars in that category because the category field is a foreign key in the Car model and on_delete is Protected
Category with the mentioned id will be deleted from the database
POST
color
model
register_num
category
token
{
"color": "Blue",
"model": 2005,
"register_num": 1988,
"category": 2,
"register_cars": 3
}
(http://127.0.0.1:8000/vehicles/car/)
GET
Token
{
"count": 3,
"next": null,
"previous": null,
"results": [
{
"color": "Black",
"model": 2007,
"register_num": 1988,
"category": 2,
"register_cars": 3
},
{
"color": "Blue",
"model": 2005,
"register_num": 1988,
"category": 2,
"register_cars": 3
},
{
"color": "white",
"model": 2006,
"register_num": 1988,
"category": 2,
"register_cars": 3
}
]
}
(http://127.0.0.1:8000/vehicles/car/2)
GET
token
{
"color": "Black",
"model": 2007,
"register_num": 1988,
"category": 2,
"register_cars": 2
}
(http://127.0.0.1:8000/vehicles/car/1/)
PUT
color model token
{ "color": "purple", "model": 2010, "register_num": 1314, "category": 2, "register_cars": 3 }
(http://127.0.0.1:8000/vehicles/car/1/)
DELETE
token
Car with the mentioned id will be deleted from the database