Skip to content

Users

Introduction

The Users API allows you to interact with our users data

Usage

List

List all Users that the user has the authority to see withing the context of a Business

Parameters

PropertyTypeRequiredExample
pageNumbernumber1

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"
}
]

Get

Retrieve a User by ID that the user has the authority to see within the context of a Business

Parameters

PropertyTypeRequiredExample
user_idXuid'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"
}

Get Permission

Retrieve a users Permissions

Parameters

PropertyTypeRequiredExample
user_idUUIDf3ce14b8-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
}
]
}

Get By Group

Pagination Enabled

List all the users associated with a group.

Parameters

PropertyTypeRequiredExample
group_idUUIDf3ce14b8-b542-11ea-aded-01002da17977
pageNumbernumber1

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

Update a user by ID

Parameters

PropertyTypeRequiredExample
_idXuid'e7e16998-3d2e-11ea-be36-01002da17977'
first_nameString'Tony'
last_nameString'Stark'
emailString'TonyStark@Avengers.com'
contact_noString'01234 567890'
job_titleString'CEO'
avatarString'https://someurl.com/avatar'
is_activeInteger1

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

Delete a user by ID

Parameters

PropertyTypeRequiredExample
_idXuid'e7e16998-3d2e-11ea-be36-01002da17977'

Usage

await Xedi.User.delete('e7e16998-3d2e-11ea-be36-01002da17977');

Restore

Restore a soft deleted user by ID

Parameters

PropertyTypeRequiredExample
_idXuid'e7e16998-3d2e-11ea-be36-01002da17977'

Usage

await Xedi.User.restore('e7e16998-3d2e-11ea-be36-01002da17977');