AdminUsersResource
This class is used to send requests to Admin User API Routes. All its method
are available in the JS Client under the medusa.admin.users property.
All methods in this class require user authentication.
A store can have more than one user, each having the same privileges. Admins can manage users, their passwords, and more.
Related Guide: How to manage users.
Methods
create
Create an admin user. The user has the same privileges as all admin users, and will be able to authenticate and perform admin functionalities right after creation.
Example
Parameters
payloadAdminCreateUserPayloadRequiredcustomHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<AdminUserRes>RequiredResolves to the user's details.
ResponsePromiseResponsePromise<AdminUserRes>Requireddelete
Delete a user. Once deleted, the user will not be able to authenticate or perform admin functionalities.
Example
Parameters
idstringRequiredcustomHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<DeleteResponse>RequiredResolves to the deletion operation's details.
ResponsePromiseResponsePromise<DeleteResponse>Requiredlist
Retrieve all admin users.
Example
Parameters
customHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<AdminUsersListRes>RequiredResolves to the list of users.
ResponsePromiseResponsePromise<AdminUsersListRes>RequiredresetPassword
Reset the password of an admin user using their reset password token. You must generate a reset password token first for the user using the sendResetPasswordToken method, then use that token to reset the password in this method.
Example
Parameters
The reset details.
customHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<AdminUserRes>RequiredResolves to the user's details.
ResponsePromiseResponsePromise<AdminUserRes>Requiredretrieve
Retrieve an admin user's details.
Example
Parameters
idstringRequiredcustomHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<AdminUserRes>RequiredResolves to the user's details.
ResponsePromiseResponsePromise<AdminUserRes>RequiredsendResetPasswordToken
Generate a password token for an admin user with a given email. This also triggers the user.password_reset event. So, if you have a Notification Service installed
that can handle this event, a notification, such as an email, will be sent to the user. The token is triggered as part of the user.password_reset event's payload.
That token must be used later to reset the password using the resetPassword method.
Example
Parameters
The user's reset details.
customHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<void>Requiredupdate
Update an admin user's details.
Example
Parameters
idstringRequiredpayloadAdminUpdateUserPayloadRequiredcustomHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<AdminUserRes>RequiredResolves to the user's details.
ResponsePromiseResponsePromise<AdminUserRes>Required