Commit a472dfe1 authored by freetux's avatar freetux

fix reademe and add develop section

parent 869d1508
......@@ -6,9 +6,23 @@ An example Django REST framework project for test driven development.
### API Endpoints
#### Api-token/
#### user
* **/api-token-auth/**
* **/api/user/** (User registration endpoint)
allow methods:post
example:
POST:
curl -X POST -d "email=youremail&password=yourpassword" tanbama.ir/api/user/
output:
give you a token and your user data.
* **/api/user/api-token-auth/**
provides JSON Web Token Authentication
allow methods:post
......@@ -18,10 +32,9 @@ POST:
curl -X POST -d "username=yourusername&password=yourpassword" tanbama.ir/api/api-token-auth/
output:
token: "yourtoken"
token: "yourtoken" and "user data"
* **/api-token-refresh/**
* **/api/user/api-token-refresh/**
your tokens can be "refreshed" to obtain a brand new token with renewed expiration time.
......@@ -32,45 +45,94 @@ POST:
curl -X POST -H "Content-Type: application/json" -d '{"token":"<EXISTING_TOKEN>"}' tanbama.ir/api/api-token-refresh/
#### Users
* **/api/users/** (User registration endpoint)
allow methods:post
example:
POST:
#### body/weights
* **/api/body/weights/** (weights and height create and list endpoint)
Allowed methods:GET, POST
GET:
curl -H "Authorization: JWT yourtoken" -H "Content-type: application/json" -H "Accept: application/json" -X GET tanbama.ir/api/body/weights
curl -X POST -H 'Content-Type: application/json' -d "username=yourusername&password=yourpassword" tanbama.ir/api/users/
output:
delete your token from database.dont worry you can login for another one!
list of your height and weights
POST
curl -H "Authorization: JWT yourtoken" -H "Content-type: application/json" -H "Accept: application/json" -d '{"weight":70,"height":182,"text":"demo"}' -X POST tanbama.ir/api/body/weights
#### weights
* **/api/weights/** (weights and height create and list endpoint)
output:
create an weight and height to database
* **/api/body/weights/{weight-id}/** (weight and height retrieve, update and destroy endpoint)
#### body/drug
* **/api/body/drug/** (drug create and list endpoint)
Allowed methods:GET, POST
GET:
curl -H "Authorization: JWT yourtoken" -H "Content-type: application/json" -H "Accept: application/json" -X GET tanbama.ir/api/weights
curl -H "Authorization: JWT yourtoken" -H "Content-type: application/json" -H "Accept: application/json" -X GET tanbama.ir/api/body/drug
output:
list of your height and weights
list of drugs
POST:
POST
curl -H "Authorization: JWT yourtoken" -H "Content-type: application/json" -H "Accept: application/json" -d '{"weight":70,"height":182,"text":"demo"}' -X POST tanbama.ir/api/weights
curl -H "Authorization: JWT yourtoken" -H "Content-type: application/json" -H "Accept: application/json" -d '{"name":drug-name,"description":"drug-description"}' -X POST tanbama.ir/api/body/drug
output:
create an weight and height to database
add a drug to database but just stuff users can add drug!
* **/api/body/drug/{drug-id}/** (drug retrieve, update and destroy endpoint)
and also just stuff users can update and destroy drug!
#### body/rx
* **/api/body/rx/** (rx create and list endpoint)
Allowed methods:GET, POST
GET:
curl -H "Authorization: JWT yourtoken" -H "Content-type: application/json" -H "Accept: application/json" -X GET tanbama.ir/api/body/rx
output:
list of rxs for each user
POST:
curl -H "Authorization: JWT yourtoken" -H "Content-type: application/json" -H "Accept: application/json" -d '{"user":user,"drugs":"drugslist"}' -X POST tanbam a.ir/api/body/rx
output:
add a rx to database but just stuff users can add rx!
* **/api/weights/{weight-id}/** (weight and height retrieve, update and destroy endpoint)
* **/api/body/rx/{rx-id}/** (rx retrieve, update and destroy endpoint)
and also just stuff users can update and destroy rx!
### Install
......@@ -78,4 +140,26 @@ create an weight and height to database
### Usage
python manage.py test
how to development:
dependencies:
1.python 3
3.pip package management system
### Install
1.make a python3 virtualenv
virtualenv -p python3 tanbamaenv
2.go to virtualenv
source tanbamaenv/bin/activate
3.install requirements
pip install -r requirements.txt
now everything is ok and you can cd to ranbamaapp directory and run server
cd tanbamaapp
python manage.py runserver
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment