Documentation

8. User List API Endpoint

Make a GET request to this resource to retrieve the list of users.

GET /api/v1/users/
HTTP 200 OK
Content-Type: application/json
Vary: Accept
Allow: GET, POST, HEAD, OPTIONS
X-API-Time: 0.049s


{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 1,
            "type": "user",
            "url": "/api/v1/users/1/",
            "related": {
                "admin_of_organizations": "/api/v1/users/1/admin_of_organizations/",
                "organizations": "/api/v1/users/1/organizations/",
                "credentials": "/api/v1/users/1/credentials/",
                "permissions": "/api/v1/users/1/permissions/",
                "activity_stream": "/api/v1/users/1/activity_stream/",
                "projects": "/api/v1/users/1/projects/",
                "teams": "/api/v1/users/1/teams/"
            },
            "created": "2015-08-25T01:00:07.127Z",
            "username": "admin",
            "first_name": "",
            "last_name": "",
            "email": "[email protected]",
            "is_superuser": true,
            "ldap_dn": ""
        }
    ]
}

The resulting data structure contains:

{
    "count": 99,
    "next": null,
    "previous": null,
    "results": [
        ...
    ]
}

The count field indicates the total number of users found for the given query. The next and previous fields provides links to additional results if there are more than will fit on a single page. The results list contains zero or more user records.

8.1. Results

Each user data structure includes the following fields:

  • id: Database ID for this user. (integer)
  • type: Data type for this user. (multiple choice)
  • user: User
  • url: URL for this user. (string)
  • related: Data structure with URLs of related resources. (object)
  • created: Timestamp when this user was created. (datetime)
  • username: Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters (string)
  • first_name: (string)
  • last_name: (string)
  • email: (email)
  • is_superuser: Designates that this user has all permissions without explicitly assigning them. (boolean)
  • password: Write-only field used to change the password. (string)
  • ldap_dn: (string)

8.2. Create Users

Make a POST request to this resource with the following user fields to create a new user:

  • username: Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters (string, required)
  • first_name: (string, default=””)
  • last_name: (string, default=””)
  • email: (email, default=””)
  • is_superuser: Designates that this user has all permissions without explicitly assigning them. (boolean, default=False)
  • password: Write-only field used to change the password. (string, default=””)

8.3. Reviewing the Options Endpoint

The Options Endpoint table offers a view of the Options for this endpoint. When viewing the endpoint in the browsable API, clicking the “Options” button gives you the raw JSON for the following:

name User List
description # List Users: Make a GET request to this resource to retrieve the list of users.
renders
0 application/json
1 text/html
parses
0 application/json
added_in_version 1.2
actions
POST
username
type string
required
true
label username
help_text Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters
max_length 30
first_name
type string
required
false
label first name
max_length 30
default (Empty Text)
last_name
type string
required
false
label last name
max_length 30
default (Empty Text)
email
type email
required
false
label email address
max_length 75
default (Empty Text)
is_superuser
type boolean
required
false
label superuser status
help_text Designates that this user has all permissions without explicitly assigning them.
default
false
password
type string
required
false
help_text Write-only field used to change the password.
default (Empty Text)
write_only
true
GET
id
type integer
label ID
help_text Database ID for this user.
type
type multiple choice
help_text Data type for this user.
choices
0
0 user
1 User
url
type string
help_text URL for this user.
related
type object
help_text Data structure with URLs of related resources.
created
type datetime
help_text Timestamp when this user was created.
username
type string
label username
help_text Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters
first_name
type string
label first name
last_name
type string
label last name
email
type email
label email address
is_superuser
type boolean
label superuser status
help_text Designates that this user has all permissions without explicitly assigning them.
ldap_dn
type string
types
0 user
search_fields
0 username
1 first_name
2 last_name
3 email