SOLVED

Rest API - Email validation

Go to solution
dark_turtle
Level 1

Rest API - Email validation

Hello,

 

I am using the /rest/v1/leads.json endpoint to sync leads, and sometimes I get errors about the email format (Invalid value for field 'email').
Would it be possible to get the exact regular expression used on Marketo side for the email dataType?
This would help align with the client-side validation and make sure no leads are missed.


Thanks !

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Rest API - Email validation

I don’t understand what you mean by “only invalid email addresses are rejected.“

 

This isn’t true: via API, Marketo does reject RFC-valid addresses, such as a single-label domain (right-hand-side) or a quoted left-hand-side with whitespace.

View solution in original post

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Rest API - Email validation

Are you having RFC-compliant email addresses rejected? Can you give some examples?
dark_turtle
Level 1

Re: Rest API - Email validation

Thanks for the reply!
No, only invalid email addresses are rejected, so no problem on Marketo side.


What I want is to reject invalid email addresses before they are sent to Marketo, to make sure the user corrects it in my form, but I can't rely on the Marketo error response at the time the user is on the form (data is sent to Marketo afterwards).


I try to enhance the regExp following each new Marketo rejection, so eventually both will be aligned, but it would be easier for me to get the perfect regExp already, if it's possible 🙂

SanfordWhiteman
Level 10 - Community Moderator

Re: Rest API - Email validation

I don’t understand what you mean by “only invalid email addresses are rejected.“

 

This isn’t true: via API, Marketo does reject RFC-valid addresses, such as a single-label domain (right-hand-side) or a quoted left-hand-side with whitespace.

dark_turtle
Level 1

Re: Rest API - Email validation

Thanks for this information, it's good to know.


This makes the Marketo email validation even more mysterious, that's why it would be nice to have it documented somewhere, so developers could anticipate the behaviour and improve their client-side email validation.

SanfordWhiteman
Level 10 - Community Moderator

Re: Rest API - Email validation

Agreed, it’s doubly frustrating because not all input methods use the same validation. A Marketo form post is not as strict, conforming more to the actual RFC. But the stricter validation is not officially documented.