Users Autocomplete
This endpoint retrieves the list of all users that meet the search criteria. The user object returned will contain only the following attributes: id, username, real_name, ext_id and avatar.
This endpoint is recommended for implementing an autocomplete input field.
info
This operation requires authentication only if content_availability
community option is false.
HTTP Request
GET /api/v2/user/autocomplete/
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
limit | query | integer | false | Number of results to return per page |
offset | query | integer | false | The initial index from which to return the results |
search | query | string | false | A search term. Search in fields: username, real_name |
username | query | string | false | Filter using field username |
gender | query | string | false | Filter using field gender type |
real_name | query | string | false | Filter using field real_name |
location | query | string | false | Filter using field location |
description | query | string | false | Filter using field description |
ordering | query | string | false | Ordering fields (eg: ?ordering=username ). Minus char is used for descending ordering, eg. -username |
Example Request
- JavaScript
- Bash
const headers = {
'Accept':'application/json',
'Authorization: Bearer <token>'
};
fetch('/api/v2/user/autocomplete/',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
# You can also use wget
curl -X GET /api/v2/user/autocomplete/ \
-H 'Accept: application/json'
-H "Authorization: Bearer <token>"
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Response status code | Inline |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» count | integer | false | none | Total results count |
» next | string(uri)¦null | false | none | Next page url |
» previous | string(uri)¦null | false | none | Previous page url |
» results | list(User) | false | none | List of results. Every items will contain only the following attributes: id, username, real_name, ext_id and avatar |
Example responses
- 200
{
"count": "integer",
"next": "string(uri)",
"previous": "string(uri)",
"results": [
{
"id": "integer",
"username": "string",
"real_name": "string",
"avatar": "string",
"ext_id": "integer"
}
]
}