AnsweredAssumed Answered

REST API v10 - Sugar 7 - Problem getting contact by email address (Other than Primary)

Question asked by Vineeta Prashar on Mar 24, 2015
Latest reply on Mar 6, 2017 by Vineeta Prashar

SugarCRM Enterprise, Version 7.5.1.0 (Build 1070)



We are trying to query contacts (using GET) using any email address and using following query:
https://MySugarUri/rest/v10/Contacts&filter[0][email_addresses.email_address]=test@email.com
It returns the record, only if the email address is the primary address. Also, email2 is not getting populated here. So, can't use email1, email2 to query. Here is the response -
 "email": [                {
                    "email_address": "test@email123.com",
                    "primary_address": true,
                    "reply_to_address": false,
                    "invalid_email": false,
                    "opt_out": false
                },
                {
                    "email_address": "test01@email123.com",
                    "primary_address": false,
                    "reply_to_address": false,
                    "invalid_email": false,
                    "opt_out": false
                },
                {
                    "email_address": "test03@email123.com",
                    "primary_address": false,
                    "reply_to_address": false,
                    "invalid_email": false,
                    "opt_out": false
                }
            ],
            "email1": "riva02@email123.com",
            "email2": "",
            "invalid_email": false,
            "email_opt_out": false,
            "email_addresses_non_primary": "",



If the email address is not primary e.g. test01@email123.com, we get :
{    "next_offset": -1,
    "records": []
}

Same is the case for Accounts as well. However, it works fine for Users.

Outcomes