This is the Django RESTful API for MailSafe Application. The endpoints can be tested locally using PostMan with the endpoints provided below. The docker container uses the Alpine image.
NOTE ALL ENDPOINTS ARE RESTRICTED VIA Authenticated Header
Authorization : Token --> Example All payload i s of raw json type
Access Admin panel via browser directly
admin/
Access to domains
alias/<str:DOMAIN>'
Login token requires payload
/auth/users/token/email/
payload
{
"username": "admin",
"password": "123"
}
response
{
"token": "",
"user_id": ""
}
Delete
v1/domains/:domain/aliases/:id
Domains
def get_alias_filtered(request, DOMAIN):
"""
Return Domain filtered by domain
API_ENDPOINT:api/v1/alias/<domains>
Json raw body
---------------
Auth will be header with key Authorization : Token a85efc83ccb629878a4d6d15e1fc1ffb51136da9
{
"name": "432",
"recipients": "[email protected]",
"is_enabled": true
}
- Clone the Application
- Start docker
- Go to the folder containing docker container and execute
docker build .
- Now execute
docker-compose build
This should install all required packages and setup the container. - To start server use
docker-compose up
this should run server on localhost:8000 - Now go to .env example and setup the environ variables as stated inside the file
- To run normal Django commands through container use the following example
docker-compose run app sh -c "python manage.py migrate"