Validate an Email Address

POST /v1/validations/email

Validates an email address.

User Roles

User Role Description
ADMIN Can issue this request
MEMBER Can issue this request
anonymous Can issue this request

Request Parameters

Location Data Item Type Required/ Optional Description
body data object required
body data.type string required The type of data (validations_email in this case)
body data.attributes object required
body data.attributes.email_address string required The email address to validate

Example Request

Note: The authorization header is not required for this request.

POST /v1/validations/email  HTTP/1.1
Host: api.ampermusic.com
Content-Type: application/vnd.api+json

Body

{
    "data": {
        "type": "validations_email",
        "attributes": {
            "email_address": "john.smith@example.com"
        }
    }
}

Response Data

Data Item Type Description
data object
data.type string The type of data (validations_email in this case)
data.id string The validated email address
data.attributes object
data.attributes.email_address string The validated email address
data.attributes.is_unique boolean If true, the email address is unique and not registered to any other user
data.attributes.is_valid_for_create boolean If true, the email address would be accepted for creation of a new account. If this value is true, ValidationsEmail.is_valid_for_update is also guaranteed to be true
data.attributes.is_valid_for_update boolean If true, the email address would be accepted for updating an existing account. This value does not consider the uniqueness of the email address and may be true while ValidationsEmail.is_valid_for_create is false
data.attributes.validation_message string Null if the email address is valid. Otherwise, a message indicating why the address is invalid
data.links object
data.links.self string The account URL.
links object
links.self string This account URL.

Example Response — Valid Email Address

An example response to a request to validate the email address “john.smith@example.com”.

Header

HTTP/1.1 200 OK

Body

{
    "data": {
        "type": "validations_email",
        "id": "john.smith@example.com",
        "attributes": {
              "email_address": "john.smith@example.com",
              "is_unique": true,
              "is_valid_for_create": true,
              "is_valid_for_update": true,
              "validation_message": null
        },
        "links" : {
           "self" : "https://api.ampermusic.com/v1/validations/email"
        },
    },
    "links" : {
        "self" : "https://api.ampermusic.com/v1/validations/email"
    }
}

Example Response — Invalid Email Address

An example response to a request to validate the email address “BadEmailAddress”.

Header

HTTP/1.1 200 OK

Body

{
    "data": {
        "type": "validations_email",
        "id": "BadEmailAddress",
        "attributes": {
            "email_address": "BadEmailAddress",
            "is_unique": true,
            "is_valid_for_create": false,
            "is_valid_for_update": false,
            "validation_message": "The email address is not valid. It must have exactly one @-sign."
        },
        "links" : {
           "self" : "https://api.ampermusic.com/v1/validations/email"
        },
    },
    "links" : {
        "self" : "https://api.ampermusic.com/v1/validations/email"
    }    
}