PUT user/…/email-addresses/…/set-primary

PUT Assigns one of the user's email addresses as the primary email address.

The primary email address is the address used to send email to. Any of the user's email addresses can be used for authentication. In order for an email address to be designated as the primary address, it must be verified first.

Resource URL

https://www.drillster.com/api/2/user/{user_id}/email-addresses/{email_address}/set-primary

Parameters

Field Description
user_id
required

The user ID of the user to retrieve details for. To retrieve the details of the own user account, the value self may be used as well.

Example value: 7OuHq-RcQO_snGWR58TnBw

email
required

The email address to retrieve. The email address must be linked to the given user account.

Example value: john%40example.com

If a PUT request has no body (i.e. the body is empty), it is still mandatory to include a Content-Length header (i.e. Content-Length: 0). Not all HTTP clients do this automatically. For more information, please see RFC 2616.

Response

An HTTP 200 (OK) response containing a UserEmailAddresses object with the details of the email addresses stored for the requested user account.

Error responses

The following error situations are possible:

ID Response code Description
not_authenticated 401 (Unauthorized) User was not authenticated
invalid_user_id 400 (Bad request) Given user ID is not valid
nonexistent_user 404 (Not found) Requested user not found
no_access 403 (Forbidden) Caller does not have access to requested user
not_found 404 (Not found) Email address not found or not linked to this account
not_verified 400 (Bad request) Email address has not yet been verified and cannot be made the primary email address
email_not_linked 400 (Bad request) Email address not linked to account