API detail

Authentication

User Token Pair Obtain

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"username":"test_user_001",
	"password":"Hello World"
}' "http://localhost:8000/auth/token/obtain/"
POST /auth/token/obtain/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"username":"test_user_001",
	"password":"Hello World"
}
Status200 OK
Content-Typeapplication/json
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNDU2LCJqdGkiOiJmZDJmOWQ1ZTFhN2M0MmU4OTQ5MzVlMzYyYmNhOGJjYSJ9.NHlztMGER7UADHZJlxNG0WSi22a2KaYSfd1S-AuT7lU",
    "refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImNvbGRfc3R1ZmYiOiLimIMiLCJleHAiOjIzNDU2NywianRpIjoiZGUxMmY0ZTY3MDY4NDI3ODg5ZjE1YWMyNzcwZGEwNTEifQ.aEoAYkSJjoWH1boshQAaTkf8G3yn0kapko6HFRt7Rh4"
}

User Token Refresh

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"refresh":"sample_token"
}' "http://localhost:8000/auth/token/refresh/"
POST /auth/token/refresh/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"refresh":"sample_token"
}
Status200 OK
Content-Typeapplication/json
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNTY3LCJqdGkiOiJjNzE4ZTVkNjgzZWQ0NTQyYTU0NWJkM2VmMGI0ZGQ0ZSJ9.ekxRxgb9OKmHkfy-zs1Ro_xs1eMLXiR17dIDBVxeT-w"
}

Staff token pair obtain

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"username":"test_staff_user_001",
	"password":"Hello Staff Password"
}' "http://localhost:8000/auth/token/obtain/"
POST /auth/token/obtain/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"username":"test_staff_user_001",
	"password":"Hello Staff Password"
}
Status200 OK
Content-Typeapplication/json
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNDU2LCJqdGkiOiJmZDJmOWQ1ZTFhN2M0MmU4OTQ5MzVlMzYyYmNhOGJjYSJ9.NHlztMGER7UADHZJlxNG0WSi22a2KaYSfd1S-AuT7lU",
    "refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImNvbGRfc3R1ZmYiOiLimIMiLCJleHAiOjIzNDU2NywianRpIjoiZGUxMmY0ZTY3MDY4NDI3ODg5ZjE1YWMyNzcwZGEwNTEifQ.aEoAYkSJjoWH1boshQAaTkf8G3yn0kapko6HFRt7Rh4"
}

Staff Token Refresh

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"refresh":"sample_staff_token"
}' "http://localhost:8000/auth/token/refresh/"
POST /auth/token/refresh/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"refresh":"sample_staff_token"
}
Status200 OK
Content-Typeapplication/json
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNTY3LCJqdGkiOiJjNzE4ZTVkNjgzZWQ0NTQyYTU0NWJkM2VmMGI0ZGQ0ZSJ9.ekxRxgb9OKmHkfy-zs1Ro_xs1eMLXiR17dIDBVxeT-w"
}

SuperUser Token Pair obtain

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"username":"sample_superuser_001",
	"password":"Hello Superuser Password"
}' "http://localhost:8000/auth/token/obtain/"
POST /auth/token/obtain/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"username":"sample_superuser_001",
	"password":"Hello Superuser Password"
}
Status200 OK
Content-Typeapplication/json
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNDU2LCJqdGkiOiJmZDJmOWQ1ZTFhN2M0MmU4OTQ5MzVlMzYyYmNhOGJjYSJ9.NHlztMGER7UADHZJlxNG0WSi22a2KaYSfd1S-AuT7lU",
    "refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImNvbGRfc3R1ZmYiOiLimIMiLCJleHAiOjIzNDU2NywianRpIjoiZGUxMmY0ZTY3MDY4NDI3ODg5ZjE1YWMyNzcwZGEwNTEifQ.aEoAYkSJjoWH1boshQAaTkf8G3yn0kapko6HFRt7Rh4"
}

SuperUser Token Refresh

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{
	"refresh":"sample_superuser_token"
}' "http://localhost:8000/auth/token/refresh/"
POST /auth/token/refresh/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Accept: application/json

{
	"refresh":"sample_superuser_token"
}
Status200 OK
Content-Typeapplication/json
{
    "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNTY3LCJqdGkiOiJjNzE4ZTVkNjgzZWQ0NTQyYTU0NWJkM2VmMGI0ZGQ0ZSJ9.ekxRxgb9OKmHkfy-zs1Ro_xs1eMLXiR17dIDBVxeT-w"
}

Users

Get Users (Staff only)

curl -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer sample_staff_token" "http://localhost:8000/users?limit=10"
GET /users?limit=10 HTTP/1.1
Host: localhost:8000
Accept: application/json
Content-Type: application/json
Authorization: Bearer sample_staff_token

Get user details

curl -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer sample_token" "http://localhost:8000/users/test_user_001"
GET /users/test_user_001 HTTP/1.1
Host: localhost:8000
Accept: application/json
Content-Type: application/json
Authorization: Bearer sample_token