How can I retrieve list members using given a unique_email_id on Mailchimp API v3? - mailchimp

Given a unique_email_id, how can I retrieve all list members matching that ID?
I am attempting to use the search-members endpoint, ala what I do for searching email-addresses:
https://us9.api.mailchimp.com/3.0/search-members?query=chris#chris.com
but instead (given a unique_email_id of 4dce5
https://us9.api.mailchimp.com/3.0/search-members?query=4dce5
and I'm getting no results.
Is there another endpoint I'm missing?

However using the query string ?unique_email_id=X attached to the end
of GET lists/list_id/members will pull up anyone with that specific
EUID.
Indeed this works very well. Example :
GET /3.0/lists/dfc3cf4b38/members?unique_email_id=f4b75a9d78&fields=members.email_address
will return :
{"members":[{"email_address":"my_email#hotmail.com"}]}

I've had a chat with the mailchimp support about this issue. This was there response (part of it because not everything discussed in that chat is relevant to this question):
(09:00:04 AM) Mailchimp support: Thanks for hanging in there, Me. It looks like
the email_unique_id can't be searched via API endpoint like it can be
within the app. Another option to get to your goal is GET to
lists/list_id/members with the query string
?fields=members.email_address,members.unique_email_id which should
pull up all their subscribers' emails and unique ids. At that point,
you can filter through those results for the unique id
(09:00:52 AM) Me: Same goes for the user ID I guess?
(09:02:05 AM) Me: Why can't it be searched? When I list ids as well I might miss information. I don't need the unique_email_id in my response, I need to search for it to retrieve user information without getting duplicates in my result
(09:07:11 AM) Mailchimp support: Ok I understand, one
moment while we test this out for you. Thanks again for your patience!
(09:16:22 AM) Mailchimp support: Hey Me, thanks for waiting. I tested the
endpoint lists/list_id/members?unique_email_id=e8da8fa60a and  I was
able to return just the one subscriber with that field. Search-Members
only functions the way it does in app where you can only search
specific strings like names, email addresses, but not ids as those
aren't visible in app. However using the query string
?unique_email_id=X attached to the end of GET lists/list_id/members
will pull up anyone with that specific EUID.

Related

Filter Microsoft Graph List Messages API to only received messages

Goal: I'd like to be able to filter the "List Messages" API to only return emails that are sent to the user rather than any messages that exist anywhere (such as ones sent out by the user).
Right now, if you query this particular API, you get a list of all of the messages in all folders (including Deleted Items and Clutter folders).
I know that I can filter on isDraft eq false to remove the drafts - but I don't know if there's any filter to say don't include messages sent by the user.
What I've Tried: I've looked over the examples and didn't see anything about filtering like this. I've also taken a look at the OData Query Params and dug into the filter param. The problem is I'm not quite sure what I could even filter on. I do see that there is a sender parameter - but given I've connected via OAuth and haven't asked users to provide their email address I'm not sure I have an easy way to filter on that.
Theoretically, I could first do a request to the https://graph.microsoft.com/beta/me/ endpoint to get the userPrincipalName and then add a filter on from/emailAddress/address ne '<userPrincipalName>' when I call the /me/messages endpoint - but that's going to double the number of API calls I'd need to make. Is that the only option I have or is there a better way to go about this?
Thanks for your time :)
There is no filter parameter that will achieve this directly. If you want to filter away sent messages - you'll need to either decode the base64 encoded JWT access token and extract the userPrincipalName or make a call to the /me endpoint and retrieve the userPrincipalName from that. Once you have that, you can add a filter of from/emailAddress/address ne '<userPrincipalName>'.
Please note that if you are filtering on many things and you have an "order by" param that you'll need to include that param in your filter or you'll receive an error about too many filters.

Filter results from YouTube data API based on date

I am trying to filter data from YouTube data API (using commentThreads).
Goal here is to get all the comments published for the channel after 2018-03-25. I have tried different date formats and it looks like the filter is not working as I get all the results back.
Any ideas?
https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&allThreadsRelatedToChannelId=UCU34OIeAyiD4BaDwihx5QpQ&key=xxxx&maxResults=100&publishedAfter=2018-03-25T13:15:30Z
I've never used the Youtube google api, but assuming that this is the API reference: https://developers.google.com/youtube/v3/docs/commentThreads/list
It doesn't mention the publishedAfter-option, which leads me to believe that it doesn't exist?
This probably means that you'll need to use the order option along with maxResults to achieve your goal.

MailChimp API 3.0 search-members query format

I’m trying to use the MailChimp - Search Members function. I want to use this action as a general search for retrieving members from all lists which match a query.
When I try the URI as formatted in the example:
https://us13.api.mailchimp.com/3.0/search-members?query=freddie#
I get the following error:
{"type":"https://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Invalid Resource","status":400,"detail":"An error occurred: Sorry, we're unable to search at the moment.","instance":""}
If I leave out the query parameter I receive the following error:
{"type":"https://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Invalid Resource","status":400,"detail":"Please provide 'query' parameter in the query string to search","instance":""}
So the method is available and my request URI is being parsed.
I conclude that the query parameter is incorrectly formed, however after extensive research I cannot find out how to format the query parameter.
This was an issue at Mail Chimp.
If you get it make a GET call to your root url e.g.
https://us13.api.mailchimp.com/3.0/
And send them your account Id along with the issue.
They can then reindex your lists.
Thanks anyone who invested time in this issue
See reply below.
J (MailChimp)
Jul 24, 5:49 PM EDT
Hey Dev, thanks so much for providing that info. I found the account and was able to replicate the error you are seeing - looks like it's account specific.
I reindexed your lists and then was able to make the same call successfully this time. If you do ever run across this issue again, that is likely what is going on. Shooting us an email or jumping in chats with this request will get it resolved in no time :)
Let me know if you are still experiencing that same error when making this call and I'll be happy to take another look, but you should be good to go at this point. Hope all is well, and have a great rest of your week!
============================================

Returning custom contact fields via the Google contacts api

I have been unable to return any UserDefined/custom fields for a contact. I'm not even wanting to create or update an existing entry as per Programatically adding "New Custom Field" To Google Contacts using Google contact API
I have followed the guide here https://developers.google.com/google-apps/contacts/v3/reference, but still to no avail.
I've called both
https://www.google.com/m8/feeds/contacts/default/full?alt=json
and
https://www.google.com/m8/feeds/contacts/default/full/DEADBEEF?alt=json
in an attempt to get ALL of the values returned. I thought I might have to call each contact id specifically to get the full details, but that doesn't work either.
DEADBEEF is clearly replaced with a valid contact id in my scenario.
/contacts/default determines that request should return contacts for the current auth'd user, which is myself in this case.
Has anyone managed to return custom values, is this even possible?
Thanks
I found the answer, add the ?v=3.0 to the url string eg
https://www.google.com/m8/feeds/contacts/default/full/DEADBEEF?alt=json&v=3.0
However, you should use the preferred method of adding a GData-Version header.

How can I get ESPN Developer to return more golfers?

I just created an account with ESPN Developer, and I'm trying to get a list of all the Professional Golfers. I made the following request:
http://api.espn.com/v1/sports/golf/athletes?&apikey=[mykey]
Unfortunately, the browser only shows a handful of names (which are in alphabetical order). How can I get the API request to return all the golfers?
According to my research, you should be seeing all of the Golfers that they have.
If you use http://api.espn.com/v1/sports/golf?apikey=KEY, you will get a list of "all organizing bodies" in the sport. You can (if you have the patience) go through that list, and check to see if they are listed in the data returned from your (correct) API URI, along with the members of each section.
You can also use http://api.espn.com/v1/sports/golf/pga/athletes?apikey=KEY to get a list of athletes in that organization. Be sure to replace "pga" if you are looking for something else.
I just now created a Developer account there and requested a key to assist you with your question, so I could be wrong. If I am I will certainly come back to better answer your question.
I am reading this post http://www.javacodegeeks.com/2013/06/parsing-espn-api-using-java-and-google-gson.html
The NBA request http://api.espn.com/v1//sports/basketball/nba/athletes?apikey=KEY returns only 50 athletes, you have to use the offset parameter to get more
http://api.espn.com/v1//sports/basketball/nba/athletes?apikey=KEY&offset=51
So in your case
http://api.espn.com/v1/sports/golf/athletes?&apikey=KEY&offset=51
I am still reading the post but now I see I can return more players and the first request only got to players last name ending with B so geeze to get all athletes the JSON response would be huge!
I can't find this on the ESPN docs, so I don't know how developers are supposed to know this, there may be a better way but at least now I know how to get all the players.

Resources