Links

Users

Overview of users API methods
post
https://api.codemash.io
/:version/membership/users/register
Register User
.NET
Node
var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);
​
membershipService.RegisterUser(new RegisterUserRequest
{
Email = "[email protected]",
Password = "password123"
});
​

Membership Settings

There are some settings for user registration inside your dashboard under sections Registration and Verification.
  • User registers as - if you don't provide roles during registration, the user will be given a selected role in the settings.
  • Verification by email needed - if this is checked, the user will be unverified until verified through email. Email service needs to be enabled for this option. Also in your template, you have to set a token named @Model.ValidationToken which will be replaced by a verification token.
post
https://api.codemash.io
/:version/membership/users/invite
Invite User
.NET
Node
var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);
​
membershipService.InviteUserAsync(new InviteUserRequest
{
Email = "[email protected]",
});
​

Membership Settings

There are some settings for user invitation inside your dashboard under sections Registration and Invitation.
  • User registers as - if you don't provide roles during registration, the user will be given a selected role.
  • Allow invite users - this MUST be checked for invitations to work. Email service needs to be enabled for this option. Also in your template, you have to set a token named @Model.ValidationToken which will be replaced by an invitation token.
get
https://api.codemash.io
/:version/membership/users
Get Users
.NET
Node
var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);
​
var response = await membershipService.GetUsersListAsync(new GetUsersRequest());
​
get
https://api.codemash.io
/:version/membership/users/:id
Get User
.NET
Node
var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);
​
var response = await membershipService.GetUserAsync(new GetUserRequest
{
Id = Guid.Parse("{USER_ID}")
});
​
get
https://api.codemash.io
/:version/membership/users/by-email
Get User (By Email)
.NET
var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);
​
var response = await membershipService.GetUserAsync(new GetUserRequest
{
});
patch
https://api.codemash.io
/:version/membership/users/profile
Update profile
.NET
var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);
​
var response = await membershipService.UpdateUserAsync(new UpdateUserRequest
{
Id = Guid.Parse("{USER_ID}"),
DisplayName = "Updated Name"
});
patch
https://api.codemash.io
/:version/membership/users/:id
Update user
.NET
Node
var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);
​
var response = await membershipService.UpdateUserAsync(new UpdateUserRequest
{
Id = Guid.Parse("{USER_ID}"),
DisplayName = "Updated Name"
});
​
delete
https://api.codemash.io
/:version/membership/users/:id
Delete user
.NET
Node
var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);
​
var reponse = await membershipService.DeleteUserAsync(new DeleteUserRequest
{
Id = Guid.Parse("{USER_ID}"),
});
​
patch
https://api.codemash.io
/:version/membership/users/:id/block
Block user
.NET
Node
var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);
​
var reponse = await membershipService.DeleteUserAsync(new DeleteUserRequest
{
Id = Guid.Parse("{USER_ID}"),
});
​
patch
https://api.codemash.io
/:version/membership/users/:id/unblock
Unblock user
.NET
Node
var client = new CodeMashClient(apiKey, projectId);
var membershipService = new CodeMashMembershipService(client);
​
var reponse = await membershipService.UnblockUserAsync(new UnblockUserRequest
{
Id = Guid.Parse("{USER_ID}"),
});
​