Users Index
List all users
To fetch a list of all the users use the request:
GET /users.json
Request Parameters:
The endpoint takes the following parameters:
Param | Description | Required | Type |
---|---|---|---|
api-version | The API version to target | No | String |
filter | Filters the result | No | Array |
filter[search] | Does a wildcard text search. Will find users where either of the Username, First Name or Last Name contains the search term | No | String |
filter[has-groups] | UUID of the group to filter users by. Will include users that belong to the given group only. | No | UUID |
filter[has-access] | UUID of a Resource. Will only includes users that have access to the given Resource | No | UUID |
filter[is-admin] | Passing 1 will return only Admin users | No | Boolean(1/0) |
contain | Dictates the fields to be included in the fetchsearch result | No | Array |
contain[LastLoggedIn] | Passing 1 will include user’s last log in timestamp | No | Boolean |
order | Sorts the result based on the param passed. The sorting order can also be specified as “ASC|DESC”. So “order[User.username] DESC” will sort the result by User’s username in descending order. | No | Array |
order[User.username] | Sort by Username | No | ASC|DESC |
order[User.created] | Sort by when the user were first created | No | ASC|DESC |
order[User.modified] | Sort by when the users were last modified | No | ASC|DESC |
order[Profile.first_name] | Sorts by users’ first name | No | ASC|DESC |
order[Profile.last_name] | Sorts by users’ last name | No | ASC|DESC |
order[Profile.created] | Sorts by when the users’ profile were first created. | No | ASC|DESC |
order[Profile.modified] | Sort by when the users’ profile were last modified | No | ASC|DESC |
Possible responses
Code | Description |
---|---|
200 | OK Request went through. The response payload will contain a list of matching users. |
403 | Authentication Failure The user making the request is not authenticated. |
Examples
Request with filters
So a request to fetch list of resources and to
- include LastLoggedIn
- Sort ASCending by Profile.first_name
- Using api-version v2
will look like this:
https://api.passbolt.com/users.json?
contain[LastLoggedIn]=1&
order[]=Profile.first_name ASC&
api-version=v2
Success response
A successful response will have an array of json objects. Each representing a single user. Something like this example below
{
"header": {
"id": "9f78d01c-f2df-453c-b1d4-aa600547ae93",
"status": "success",
"servertime": 1554976847,
"action": "d7bc9044-a64e-5421-a4d7-7a94eaa39d37",
"message": "The operation was successful.",
"url": "\/users.json",
"code": 200
},
"body": [
{
"id": "640ebc06-5ec1-5322-a1ae-6120ed2f3a74",
"role_id": "a58de6d3-f52c-5080-b79b-a601a647ac85",
"username": "[email protected]",
"active": true,
"deleted": false,
"created": "2019-04-02T12:05:44+00:00",
"modified": "2019-04-03T12:05:44+00:00",
"profile": {
"id": "48bcd9ac-a520-53e0-b3a4-9da7e57b91aa",
"user_id": "640ebc06-5ec1-5322-a1ae-6120ed2f3a74",
"first_name": "Carol",
"last_name": "Shaw",
"created": "2019-04-04T12:05:45+00:00",
"modified": "2019-04-04T12:05:45+00:00",
"avatar": {
"id": "31134496-e2af-4f1e-adc0-7d03523d8eef",
"user_id": "640ebc06-5ec1-5322-a1ae-6120ed2f3a74",
"foreign_key": "48bcd9ac-a520-53e0-b3a4-9da7e57b91aa",
"model": "Avatar",
"filename": "carol.png",
"filesize": 733439,
"mime_type": "image\/png",
"extension": "png",
"hash": "7445a736df60a1ac1bfdab8fc5b842a95c495aec",
"path": "Avatar\/31134496e2af4f1eadc07d03523d8eef.png",
"adapter": "Local",
"created": "2019-04-04T12:05:47+00:00",
"modified": "2019-04-04T12:05:47+00:00",
"url": {
"medium": "img\/public\/Avatar\/31134496e2af4f1eadc07d03523d8eef.a99472d5.png",
"small": "img\/public\/Avatar\/31134496e2af4f1eadc07d03523d8eef.65a0ba70.png"
}
}
},
"groups_users": [],
"role": {
"id": "a58de6d3-f52c-5080-b79b-a601a647ac85",
"name": "user",
"description": "Logged in user",
"created": "2012-07-04T13:39:25+00:00",
"modified": "2012-07-04T13:39:25+00:00"
},
"gpgkey": {
"id": "1d3d0565-f075-50d4-b58a-cbb82700e79b",
"user_id": "640ebc06-5ec1-5322-a1ae-6120ed2f3a74",
"armored_key": "-----BEGIN PGP PUBLIC KEY BLOCK-----",
"bits": 4096,
"uid": "Carol Shaw \u[email protected]\u003E",
"key_id": "82945D3E",
"fingerprint": "57DE7D79ABE733A235EB1F84CDF8FC8682945D3E",
"type": "RSA",
"expires": "2019-07-02T11:25:12+00:00",
"key_created": "2015-07-02T11:25:12+00:00",
"deleted": false,
"created": "2019-04-04T12:05:48+00:00",
"modified": "2019-04-04T12:05:48+00:00"
},
"last_logged_in": ""
}
]
}
Last updated
This article was last updated on April 23rd, 2019.You can also find the latest OpenAPI 2.0 specifications directly on the dedicated repository.
OpenAPI Specs repository