Reputation: 63
This seems like a simple thing to do, but I can't get it working. I'm querying the /Users endpoint, and I'm trying to filter the users by an email address.
When I call the endpoint with no filters, I get something like this:
"records": [
{
"id": "abc123",
"user_name": "brad",
"first_name": "Brad",
...
"email1": "",
"email": [
{
"email_address": "[email protected]",
"primary_address": true,
"reply_to_address": false,
"invalid_email": false,
"opt_out": false
}
],
...
I'm trying to filter on the email address. I've tried:
$filters = [
'filter' => [
[
'email.email_address' => [
'$contains' => 'brad'
]
]
]
];
But I get this error:
{"error":"invalid_parameter","error_message":"Invalid link email for field email_address"}
I can filter by user_name = 'brad' and it works just fine, but not when I try to go 1 level deeper.
Upvotes: 1
Views: 705
Reputation: 63
Had to email SugarCRM support directly.
Instead of:
$filters = [
'filter' => [
[
'email.email_address' => [
'$contains' => 'brad'
]
]
]
];
I needed to use email_addresses.email_address:
$filters = [
'filter' => [
[
'email_addresses.email_address' => [
'$contains' => 'brad'
]
]
]
];
Upvotes: 4