Enroll a user into a given service
Description
The EnrollUser() method is used to enroll a user given a service and (optionally) an organization. You cannot associate an internal user with an organization.
Package Details
Interface
IServiceManager
Syntax
ServiceManager.EnrollUser(int userId, int serviceId, int? organizationId = null )
Returns
Task
API
POST
/api/v1/services/{serviceId}/enrolluser?userId={userId}&organizationId={organizationId}
Parameters
Parameter | Description | Parameter Type |
---|---|---|
serviceId | Service for which the user will be enrolled to | Path |
userId | User to enroll | Query string |
organizationId (Optional) | The optional id of the organization | Query string |
Returns
On success, 200 Ok
If UserManage.GetByPermissionServiceOrg returns null, 422 Unprocessable Entity
On error, 400 Bad Request
On authorization error, 403 Forbidden
Parameters
userId: User to enroll
serviceId: Service for which the user will be enrolled to
organizationId: The optional id of the organization
Returns
200 OK
Example
int myServiceId = 12345 int myOrganizationId = 323; _serviceManager.EnrollUser(CurrentUser.Id, myServiceId, myOrganizationId); // No organization _serviceManager.EnrollUser(CurrentUser.Id, myServiceId);