Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
See what's new at GitLab
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
tanbama
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
freetux
tanbama
Commits
ce008397
Commit
ce008397
authored
Apr 25, 2018
by
freetux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make reademe better and some fixes in setting
parent
b67a7bf1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
5 deletions
+61
-5
README.md
README.md
+58
-1
tanbamaapp/tanbama/settings.py
tanbamaapp/tanbama/settings.py
+3
-3
tanbamaapp/tanbama/token
tanbamaapp/tanbama/token
+0
-1
No files found.
README.md
View file @
ce008397
...
...
@@ -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
...
...
tanbamaapp/tanbama/settings.py
View file @
ce008397
...
...
@@ -43,13 +43,13 @@ INSTALLED_APPS = [
'corsheaders'
,
'users'
,
'weights'
,
'django_nose'
]
JWT_AUTH
=
{
'JWT_EXPIRATION_DELTA'
:
datetime
.
timedelta
(
seconds
=
2592
00
),
# 3 days
'JWT_REFRESH_EXPIRATION_DELTA'
:
datetime
.
timedelta
(
seconds
=
259200
),
# 3 days
'JWT_EXPIRATION_DELTA'
:
datetime
.
timedelta
(
seconds
=
3
00
),
# 3 days
'JWT_REFRESH_EXPIRATION_DELTA'
:
datetime
.
timedelta
(
days
=
7
),
# 3 days
'JWT_AUTH_COOKIE'
:
'JWT'
,
'JWT_ALLOW_REFRESH'
:
True
,
}
...
...
tanbamaapp/tanbama/token
deleted
100644 → 0
View file @
b67a7bf1
38eb7e0a7e1efd74f1dd2de0c860f6ddee98f68a
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment