Commit ce008397 authored by freetux's avatar freetux

make reademe better and some fixes in setting

parent b67a7bf1
......@@ -5,14 +5,71 @@ An example Django REST framework project for test driven development.
### API Endpoints
#### Users
#### Api-token/
* **/api-token-auth/**
provides JSON Web Token Authentication
allow methods:post
example:
POST:
curl -X POST -d "username=yourusername&password=yourpassword" tanbama.ir/api/api-token-auth/
output:
token: "yourtoken"
* **/api-token-refresh/**
your tokens can be "refreshed" to obtain a brand new token with renewed expiration time.
allow methods:post
example:
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:
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!
#### weights
* **/api/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/weights
output:
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/weights
output:
create an weight and height to database
* **/api/weights/{weight-id}/** (weight and height retrieve, update and destroy endpoint)
### Install
......
......@@ -43,13 +43,13 @@ INSTALLED_APPS = [
'corsheaders',
'users',
'weights',
'django_nose'
]
JWT_AUTH = {
'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=259200), # 3 days
'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(seconds=259200), # 3 days
'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=300), # 3 days
'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7), # 3 days
'JWT_AUTH_COOKIE': 'JWT',
'JWT_ALLOW_REFRESH': True,
}
......
38eb7e0a7e1efd74f1dd2de0c860f6ddee98f68a
\ No newline at end of file
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