0

I've been trying several times to validate an email from my website against MAGENTO without success.

I know it is possible to use MAGENTO REST API through JAVASCRIPT or maybe a PHP script but THIS IS NOT WORKING FOR ME

MAGENTO 1.9 does NOT have this API: customers/isEmailAvailable

This is my HTML code:

<!DOCTYPE html>
<html>

<head>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<h2 style="color.darkgrey">Email validator </h2><br/>
<i id="status" class="" style="font-size:35px;color:green;display:inline-block;margin-left:5px;vertical-align:-5px;" ><i/>
<input id="email" type="email" class="form-control" style="display:inlane-block;width:300px;"  />
<button id="btn" class="btn btn-success">Validate</button>

</body>
<script type="text/javascript">
$("#btn").click(function (){
check();
});

$("#email").change(function (){
check();
});

</body>
<script type="text/javascript">
var restURL= "http://apilayer.net/api/check?access_key=c5118f1f9827f42a5fc4b231932130a8&email="+$("#email").val()+"&smtp=1&format=1"
$.ajax({
    type: 'GET',
    url: restURL,
    dataType:"json",
    success: renderList,
    });
    return false;
});

function renderList(data)
{
if((data.format_valid==true)&&(data.smtp_check==true))
    {
    $('#status').removeClass('fa fa-check-circle-o').addClass('fa fa-check-circle-o').css("color","green");
    }
    else
    {
    $('#status').removeClass('fa fa-check-circle-o').addClass('fa fa-check-circle-o').css("color","green");
    }
}


</script>
</html>

Then,i thought this code could help:

$.ajax(
    {
        url: "name",
        type: 'POST',
        data: JSON.stringify({"customerEmail": "notexist@test.com"}),
        contentType: "application/json",
        dataType: "json",
        showLoader: true,
        success: function (response) {
            alert(response);
        }
    }
);

but this WONT work because MAGENTO 1.9 does not have this API: customers/isEmailAvailable

How can i validate the email against MAGENTO 1.9? Could you please help me to modify my code?

DO NOTE: i have a TOKEN, how should i put it in my code?

EDIT#1:

Take a look at this... this is my MAGENTO API:

im1

If i click on "SEND" i get this JSON (this is just an example):

{
        "magento_id": "54678",
        "firstname": "Richard",
        "lastname": "Herther",
        "email": "Richard.Herther@sels.com",
        "password": null,
        "website_id": "8",
        "group_id": "7",
        "disable_auto_group_change": "0",
        "prefix": null,
        "middlename": null,
        "suffix": null,
        "taxvat": null,
        "account_id": [
            "785784"
        ],
        "document": "66958746845",
        "document_type": "15",
        "gender": null,
        "telephone": null
    },

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.