Register a user to your workspace.
Payload parameters
Argument | Example | Required | Description |
---|---|---|---|
| Required | The email of the channel. | |
|
| Required | The password. |
|
| Required | The name of the account. |
Example call
{
"msg": "method",
"method": "registerUser",
"id":"482",
"params": [{
"email": "[email protected]",
"pass": "test31457",
"name": "new te1st",
"secretURL": ""
}]
}
Example response
{
"msg": "result",
"id": "482",
"result": "3Dw26TXWxvi8gwfgM"
}
Errors
If there are any errors during registration, here is a sample response format to expect:
{
"msg": "result",
"id": "42",
"error": {
"error": 403,
"reason": "...",
"message": "... [403]",
"errorType": "Meteor.Error"
}
}
Possible errors
"reason": "error-user-registration-disabled",
"message": "User registration is disabled [403]",
"reason": "error-user-registration-secret",
"message": "User registration is only allowed via Secret URL [403]",
"reason": "error-invalid-customfield-json",
"message": "Invalid JSON for Custom Fields [403]",
Custom fields errors
"reason": "error-user-registration-custom-field",
"message": "Field ${ fieldName } is required [403]",
"reason": "error-user-registration-custom-field",
"message": "Value for field ${ fieldName } is invalid [403]",
"reason": "error-user-registration-custom-field",
"message": "Max length of field ${ fieldName } ${ field.maxLength } [403]",
"reason": "error-user-registration-custom-field",
"message": "Min length of field ${ fieldName } ${ field.minLength } [403]",
Accounts custom fields
You can use customFields
as extra fields for user registration.
To register with custom fields, add Accounts_CustomFields
encoded as JSON:
{
"msg": "method",
"method": "registerUser",
"id":"482",
"params": [{
"email": "[email protected]",
"pass": "test31457",
"name": "new te1st",
"secretURL": "" ,
"Accounts_CustomFields": {
"role": {
"type": "select",
"defaultValue": "student",
"options": ["teacher", "student"],
"required": true,
"modifyRecordField": {
"array": true,
"field": "roles"
}
},
"twitter": {
"type": "text",
"required": true,
"minLength": 2,
"maxLength": 10
}
}
}]
}