Validate Email Address
For the purpose of this test, we have created tree use accounts:
- User #2 with member2@activecollab.com address - Active account
- User #3 with member3@activecollab.com address - Archived account
- User #4 with member4@activecollab.com address - Trashed account
To check if a given email address is available for new user accounts (handy when inviting new users), we can use /users/check-email command. Response of this command is an object with three fields:
- valid_address - True if format of the input address is valid,
- in_use - false when address is not in use. When in use, this can have one of the following
active,achived,invitedandtrashed, - user_id - ID of an account that is using this address (NULL when there is no such account).
First, lets check for invalid email address:
Response: HTTP 200, application/json (Hide)
GET /users/check-email?email=invalid-address
Response:
1 2 3 4 5
{
"valid_address": false,
"in_use": false,
"user_id": null
}Good. Lets check for an active user account:
Response: HTTP 200, application/json (Hide)
GET /users/check-email?email=member2@activecollab.com
Response:
1 2 3 4 5
{
"valid_address": true,
"in_use": "active",
"user_id": 2
}via additional address:
Response: HTTP 200, application/json (Hide)
GET /users/check-email?email=additional-address-for-member2@activecollab.com
Response:
1 2 3 4 5
{
"valid_address": true,
"in_use": "active",
"user_id": 2
}Invite user:
Response: HTTP 200, application/json (Hide)
GET /users/check-email?email=member3@activecollab.com
Response:
1 2 3 4 5
{
"valid_address": true,
"in_use": "invited",
"user_id": 3
}Now lets check an archived user account:
Response: HTTP 200, application/json (Hide)
GET /users/check-email?email=member4@activecollab.com
Response:
1 2 3 4 5
{
"valid_address": true,
"in_use": "archived",
"user_id": 4
}And trashed account:
Response: HTTP 200, application/json (Hide)
GET /users/check-email?email=member5@activecollab.com
Response:
1 2 3 4 5
{
"valid_address": true,
"in_use": "trashed",
"user_id": 5
}Finally, lets check for an address that is not in use:
Response: HTTP 200, application/json (Hide)
GET /users/check-email?email=not-in-use@activecollab.com
Response:
1 2 3 4 5
{
"valid_address": true,
"in_use": false,
"user_id": null
}