Added user API examples
This commit is contained in:
parent
eb653bda16
commit
46e6e239dc
|
@ -72,7 +72,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||||
*/
|
*/
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
'password', 'remember_token', 'system_name', 'email_confirmed', 'external_auth_id', 'email',
|
'password', 'remember_token', 'system_name', 'email_confirmed', 'external_auth_id', 'email',
|
||||||
'created_at', 'updated_at', 'image_id', 'roles', 'avatar',
|
'created_at', 'updated_at', 'image_id', 'roles', 'avatar', 'user_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -81,6 +81,7 @@ class UserApiController extends ApiController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new user in the system.
|
* Create a new user in the system.
|
||||||
|
* Requires permission to manage users.
|
||||||
*/
|
*/
|
||||||
public function create(Request $request)
|
public function create(Request $request)
|
||||||
{
|
{
|
||||||
|
@ -111,6 +112,7 @@ class UserApiController extends ApiController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update an existing user in the system.
|
* Update an existing user in the system.
|
||||||
|
* Requires permission to manage users.
|
||||||
* @throws UserUpdateException
|
* @throws UserUpdateException
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, string $id)
|
public function update(Request $request, string $id)
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"name": "Dan Brown",
|
||||||
|
"email": "dannyb@example.com",
|
||||||
|
"roles": [1],
|
||||||
|
"language": "fr",
|
||||||
|
"send_invite": true
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"name": "Dan Spaggleforth",
|
||||||
|
"email": "dspaggles@example.com",
|
||||||
|
"roles": [2],
|
||||||
|
"language": "de",
|
||||||
|
"password": "hunter2000"
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "Dan Brown",
|
||||||
|
"email": "dannyb@example.com",
|
||||||
|
"created_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"updated_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"external_auth_id": "abc123456",
|
||||||
|
"slug": "dan-brown",
|
||||||
|
"last_activity_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"profile_url": "https://docs.example.com/user/dan-brown",
|
||||||
|
"edit_url": "https://docs.example.com/settings/users/1",
|
||||||
|
"avatar_url": "https://docs.example.com/uploads/images/user/2021-10/thumbs-50-50/profile-2021.jpg",
|
||||||
|
"roles": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"display_name": "Admin"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "Dan Brown",
|
||||||
|
"email": "dannyb@example.com",
|
||||||
|
"created_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"updated_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"external_auth_id": "abc123456",
|
||||||
|
"slug": "dan-brown",
|
||||||
|
"user_id": 1,
|
||||||
|
"last_activity_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"profile_url": "https://docs.example.com/user/dan-brown",
|
||||||
|
"edit_url": "https://docs.example.com/settings/users/1",
|
||||||
|
"avatar_url": "https://docs.example.com/uploads/images/user/2021-10/thumbs-50-50/profile-2021.jpg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"name": "Benny",
|
||||||
|
"email": "benny@example.com",
|
||||||
|
"created_at": "2022-01-31T20:39:24.000000Z",
|
||||||
|
"updated_at": "2021-11-18T17:10:58.000000Z",
|
||||||
|
"external_auth_id": "",
|
||||||
|
"slug": "benny",
|
||||||
|
"user_id": 2,
|
||||||
|
"last_activity_at": "2022-01-31T20:39:24.000000Z",
|
||||||
|
"profile_url": "https://docs.example.com/user/benny",
|
||||||
|
"edit_url": "https://docs.example.com/settings/users/2",
|
||||||
|
"avatar_url": "https://docs.example.com/uploads/images/user/2021-11/thumbs-50-50/guest.jpg"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"total": 28
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "Dan Brown",
|
||||||
|
"email": "dannyb@example.com",
|
||||||
|
"created_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"updated_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"external_auth_id": "abc123456",
|
||||||
|
"slug": "dan-brown",
|
||||||
|
"last_activity_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"profile_url": "https://docs.example.com/user/dan-brown",
|
||||||
|
"edit_url": "https://docs.example.com/settings/users/1",
|
||||||
|
"avatar_url": "https://docs.example.com/uploads/images/user/2021-10/thumbs-50-50/profile-2021.jpg",
|
||||||
|
"roles": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"display_name": "Admin"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "Dan Spaggleforth",
|
||||||
|
"email": "dspaggles@example.com",
|
||||||
|
"created_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"updated_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"external_auth_id": "abc123456",
|
||||||
|
"slug": "dan-spaggleforth",
|
||||||
|
"last_activity_at": "2022-02-03T16:27:55.000000Z",
|
||||||
|
"profile_url": "https://docs.example.com/user/dan-spaggleforth",
|
||||||
|
"edit_url": "https://docs.example.com/settings/users/1",
|
||||||
|
"avatar_url": "https://docs.example.com/uploads/images/user/2021-10/thumbs-50-50/profile-2021.jpg",
|
||||||
|
"roles": [
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"display_name": "Editors"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue