Skip to content

Instantly share code, notes, and snippets.

@pavelk2
Created December 18, 2015 13:06
Show Gist options
  • Save pavelk2/18f9e5ededba6c81b074 to your computer and use it in GitHub Desktop.
Save pavelk2/18f9e5ededba6c81b074 to your computer and use it in GitHub Desktop.

Try sending requests:

Register a new user
POST /users/registration/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Cache-Control: no-cache

{
    "username":"pavel.kucherbaev@gmail.com",
    "password1":"123456",
    "password2":"123456"
}

You expect back the following answer:

{
  "username": "pavel.kucherbaev@gmail.com",
  "email": "pavel.kucherbaev@gmail.com",
  "first_name": "",
  "last_name": ""
}
Get a token:
POST /users/token/username/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Cache-Control: no-cache

{
    "username":"pavel.kucherbaev@gmail.com",
    "password":"123456"
}

You expect back token back:

{
  "token": "593117c16294d2112b5106d0979c62623622967c"
}
Get a list of folders available:
GET /folders/ HTTP/1.1
Host: localhost:8000
Content-Type: application/json
Authorization: Token 593117c16294d2112b5106d0979c62623622967c
Cache-Control: no-cache

You get the following response back:

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1,
      "title": "My boards",
      "users": [
        {
          "id": 1,
          "username": "pavel.kucherbaev@gmail.com",
          "first_name": "",
          "last_name": "",
          "profile": {
            "avatar_url": "https://secure.gravatar.com/avatar/baec6e2c742927fafc4e1ada9f5f4995.jpg?s=150&r=g&d=mm"
          }
        }
      ],
      "email": "pavel.kucherbaev@gmail.com",
      "personal": true,
      "creator": {
        "id": 1,
        "username": "pavel.kucherbaev@gmail.com",
        "first_name": "",
        "last_name": "",
        "profile": {
          "avatar_url": "https://secure.gravatar.com/avatar/baec6e2c742927fafc4e1ada9f5f4995.jpg?s=150&r=g&d=mm"
        }
      },
      "new_boards_allowed": true
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment