The Users API allows you to interact with our users data
List all Users that the user has the authority to see withing the context of a Business
Parameters
Property | Type | Required | Example |
---|---|---|---|
pageNumber | number | 1 |
Usage
const users = await Xedi.Users.list();
Response
[{"_id": "e7e16998-3d2e-11ea-be36-01002da17977","first_name": "Tony","last_name": "Stark","email": "TonyStark@Avengers.com","contact_no": null,"job_title": null,"avatar": null,"is_active": "1","created_at": "2010-07-03 13:34:10","updated_at": "2019-07-03 15:15:10","deleted_at": "2020-09-01 12:44:10"},{"_id": "96GE2a3e-boi0-11e9-b308-013533e48b37","first_name": "Jeff","last_name": "Goldblum","email": "GoldenJeff@Avengers.com","contact_no": null,"job_title": null,"avatar": null,"is_active": "1","created_at": "2012-07-03 13:34:10","updated_at": "2019-07-03 15:15:10","deleted_at": "2020-09-01 12:44:10"}]
Retrieve a User by ID that the user has the authority to see within the context of a Business
Parameters
Property | Type | Required | Example |
---|---|---|---|
user_id | Xuid | 'e7e16998-3d2e-11ea-be36-01002da17977' |
Usage
const user = await Xedi.Users.get('e7e16998-3d2e-11ea-be36-01002da17977');
Response
{"_id": "e7e16998-3d2e-11ea-be36-01002da17977","first_name": "Tony","last_name": "Stark","email": "TonyStark@Avengers.com","contact_no": null,"job_title": null,"avatar": null,"is_active": "1","created_at": "2010-07-03 13:34:10","updated_at": "2019-07-03 15:15:10","deleted_at": "2020-09-01 12:44:10"}
Retrieve a users Permissions
Parameters
Property | Type | Required | Example |
---|---|---|---|
user_id | UUID | f3ce14b8-b542-11ea-aded-01002da17977 |
Usage
const permissions = await Xedi.Users.getPermissions('0453b1ec-44d4-31d7-bffb-accfbaab2c90');
Response
{"data": [{"Key": "audit.event.business.read","is_hidden": 0},{"Key": "audit.event.read","is_hidden": 0},{"Key": "audit.event.user.read","is_hidden": 0}]}
List all the users associated with a group.
Parameters
Property | Type | Required | Example |
---|---|---|---|
group_id | UUID | f3ce14b8-b542-11ea-aded-01002da17977 | |
pageNumber | number | 1 |
Usage
const users = await Xedi.Users.getByGroup('0453b1ec-44d4-31d7-bffb-accfbaab2c90');
Response
{"current_page": 1,"data": [{"_id": "e7e16998-3d2e-11ea-be36-01002da17977","first_name": "Tony","last_name": "Stark","email": "TonyStark@Avengers.com","contact_no": null,"job_title": null,"avatar": null,"is_active": "1","created_at": "2020-07-03 13:58:10","updated_at": "2020-07-03 13:58:10","deleted_at": "2020-09-01 13:58:10"}],"first_page_url": "https://api.xedi.com/1/users?page=1","from": 1,"last_page": "https://api.xedi.com/1/users?page=1","last_page_url": null,"next_page_url": null,"path": "https://api.xedi.com/1/users","per_page": 15,"prev_page_url": null,"to": 1,"total": 1}
Update a user by ID
Parameters
Property | Type | Required | Example |
---|---|---|---|
_id | Xuid | 'e7e16998-3d2e-11ea-be36-01002da17977' | |
first_name | String | 'Tony' | |
last_name | String | 'Stark' | |
String | 'TonyStark@Avengers.com' | ||
contact_no | String | '01234 567890' | |
job_title | String | 'CEO' | |
avatar | String | 'https://someurl.com/avatar' | |
is_active | Integer | 1 |
Usage
await Xedi.User.Update({"_id": "e7e16998-3d2e-11ea-be36-01002da17977","first_name": "Tony","last_name": "Stark","email": "TonyStark@Avengers.com","contact_no": "01234 567890","job_title": "CEO","avatar": "https://someurl.com/avatar","is_active": "1",})
Response
{"data": {"_id": "e7e16998-3d2e-11ea-be36-01002da17977","first_name": "Tony","last_name": "Stark","email": "TonyStark@Avengers.com","contact_no": "01234 567890","job_title": "CEO","avatar": "https://someurl.com/avatar","is_active": "1","created_at": "2020-09-03 14:00:00","updated_at": "2020-09-07 15:00:00","deleted_at": null}}
Delete a user by ID
Parameters
Property | Type | Required | Example |
---|---|---|---|
_id | Xuid | 'e7e16998-3d2e-11ea-be36-01002da17977' |
Usage
await Xedi.User.delete('e7e16998-3d2e-11ea-be36-01002da17977');
Restore a soft deleted user by ID
Parameters
Property | Type | Required | Example |
---|---|---|---|
_id | Xuid | 'e7e16998-3d2e-11ea-be36-01002da17977' |
Usage
await Xedi.User.restore('e7e16998-3d2e-11ea-be36-01002da17977');