Skip to content

RESTful API Auth

annypanny edited this page Nov 22, 2016 · 4 revisions

/socialnet/auth/

  • It used to test login for author.

  • It send username and password to the server.

  • Server returned a JSON file.

  • JSON file contains:

    • "username":
    • "password"
    • "author"

    and each "author" contains:

    • "id"
    • "first_name"
    • "last_name"
    • "github"
    • "host"
    • "avatar"
    • "friends"
    • "email"

Method:

POST

Example: (http://127.0.0.1:8000/socialnet/auth/)

GET /socialnet/auth/

HTTP 405 Method Not Allowed
Allow: POST, OPTIONS
Content-Type: application/json
Vary: Accept

{ "detail": "Method "GET" not allowed." }

After the user enter the username and password, it would return:

POST /socialnet/auth/

HTTP 200 OK
Allow: POST, OPTIONS
Content-Type: application/json
Vary: Accept

{
	"username": "admin",
	"password": "password123",
	"author": {
	    "id": "d7eb3e2d-424b-4662-882e-8f412091e69a",
	    "first_name": "",
	    "last_name": "",
	    "github": "admin",
	    "host": "http://127.0.0.1:8000/socialnet/",
	    "avatar": "",
	    "friends": [],
	    "email": "[email protected]"
	}
}

Clone this wiki locally