HI There
I am trying to setup an API call in order to download a contact ID based on an email address.
https://docs.sendgrid.com/api-reference/contacts/search-contacts
I am struggling with the json syntax I need to add in the API call’s body.
The examples given by Sendgrid are following:
Basically I need to query just 1 email address.
Thanks for help.
Jici
July 11, 2023, 5:14pm
2
What did you tried? Can you share API connector screenshot? Which error do you get?
Hello
I am trying to get the contact’s ID based on the email address.
Authorization and Headers are correct, since I use them for other API calls which work fine.
The Search contacts call is the on giving me trouble.
And this is the error message. Really basic invalid format error message.
Thanks!
Jici
July 11, 2023, 8:42pm
4
According to the first endpoint link, the payload should be more like
{"query": "email LIKE '<email>'"}
(don’t forget single quotes, that you don’t have in your request).
Also, add Content-type: application/json header
1 Like
Hi
Initializing worked but then I do not get the usual list of data to choose from. That seems odd…
Initialising seems OK.
Thanks!
Jici
July 12, 2023, 1:04pm
7
You need to select results. The API return a list. You may select results:first item
1 Like
Ah. Yes that was it.
What when the output is a list? Because with :first item it gives wrong results.
Jici
July 12, 2023, 1:58pm
9
What do you mean by wrong results?
First item will give you the first contact.
In this contact, you will have a list of “list” that the user is member. This is a list of text according to your screenshot.
Maybe your search constraint should be email = (IS) instead of LIKE
running the workflow (bulk from backend) for list id’s adds always the same 3 list id’s to all contacts.
IS does not seem to be an option. LIKE seems the way to go for Sendgrid.
Jici
July 12, 2023, 2:32pm
11
not is but =
And this is not impossible that different contact be on the same lists
I checked them manually. They are all wrong. It’s always the same 3 IDs that are being added.
Jici
July 12, 2023, 4:12pm
13
Do the search return the correct contact?
I tried with =
A new set of the same 3 ID’s gets added to all contacts.
Before
After running the wf. I checked on Sendgrid. Those are not the correct lists.
One is on two lists.
Another on none.
The third on one list.
Jici
July 12, 2023, 4:20pm
16
How do you set this field? Do you send the data to a schedule on a list WF? What do you do with the list of contact returned?
Initialiyzing with the contact that is on 2 lists gives at least one correct one.
Jici
July 12, 2023, 4:23pm
18
Is the contact found is the correct one?
Is there more than 1 contact returned for this email?
the contact id is correct and just 1 email is found
Jici
July 12, 2023, 4:28pm
20
I don’t know Sendgrid enough to help you more. You can call the endpoint Get a Contact by ID | Twilio and check if you get the same result