How can I get ESPN Developer to return more golfers? - espn

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.

Related

YouTube Data API for getting replies to a comment returns replies in reverse-chronological order

If I got it correctly, when I know a video ID, I use CommentThreads::list to get top-level comments, and use Comments:list to get replies for any given top-level comment. I called Comments:list with the parentId set to one of the top-level comment, but the returned replies were sorted in reverse-chronological order. That is, the first element in the items array was the latest reply. This is not useful, because both the official Android app or the YouTube website shows comments in chronological order (older replies first).
If there aren't many replies, I could simply get all replies first, and then reverse the array's order. But there could be lots of replies and in that case the result will be divided by pages. I cannot pass the page number, but the nextPageToken, so requesting pages in the reverse order (requesting nth first, and then n-1th, etc) is not possible.
The only workaround I could think of is to get all replies at once and then reverse the order. This could be problematic if there are many replies.
Is this a bug, or did I do something wrong? I could not find any "order" or "sort" parameters in the Comments:list API.
PS: It seems I can get replies using CommentThreads::list with part = replies the id = top-level comment's ID. This works (returns chronological order) when there aren't many replies, but for some reason, the API does not support paging or setting maxResults in this mode. The documentation says,
Note: This parameter is not supported for use in conjunction with the id parameter.
So, I have tested getting replies of a top-level comment with 500 replies. This method returned only the latest 5 replies.
So far, the only workaround I could find is calling Comments:list multiple times with parentId = top-level comment's ID and maxResults = 100, get ALL replies, and reverse the order on the client. Not so scable way, but there aren't many comments with hundreds replies, so, it would work for the time being.

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!
============================================

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

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.

Instagram API followers request returns ONE user

I setup a developer IG account, and am having a bit of trouble getting my user list. Every piece of data I try to grab only returns one result. I have over 100 followers and am following over 100 as well, but only one is returned.
I found this example where the user does a IG search. I try the same code with my access token (cannot use my id for some reason) and it does not work.
http://jsfiddle.net/z34bbb5r/
Really confused here. Not sure what I'm doing wrong, I followed IG's instructions. Please help if you can!
URL
https://api.instagram.com/v1/users/496457603/followed-by?access_token=XXXXXX
Results
{"pagination":{},"meta":{"code":200},"data":[{"username":"xxx","profile_picture":"https:\/\/scontent.cdninstagram.com\/xxx.jpg","id":"xxx","full_name":"XX"}]}

Google Global Address List for Domain limited to 250 results [rehash]

Reposting due to lack of answers
I'm trying to query Google Global Address List for a specific domain, being led by this answer here (Specifically the answer by Jay Lee).
It's all well and good and works perfectly in Google's OAuth Playground, however it seems to be limited to 250 users. Given that this feature seems completely undocumented, and that I can't tell by looking at their github repo (specifically this file), does anyone know how to query for the next 250 users or how to set the number of results?
Thank you!
My last answer was converted into a comment, but I now have a complete answer to this question.
EDIT: I repeatedly mention JSON but you don't need to parse this in JSON to get the syncToken. Google will provide you the syncToken regardless.
The Google GAL API seems to operate in a similar manner to the Google Calendar or YouTube API's "nextPageToken" parameter, which allows you to query the next page of results as long as you have a token.
The Google GAL uses the "syncToken" parameter as a replacement. Much like the other Google API's, if you append this syncToken to the end of your URL, you will get the next page of results. Note that I was unable to get the startIndex parameter to work (which allows you to begin at a specific item in the JSON), so if you are trying to get a specific result through the query you will most likely have to parse the entire JSON file. Inside the parsed JSON, there should be a key called "gal$syncToken." You can find it in the json right before the "entry" key/array which is where all of the global domain contacts are listed.
Here is an example of what it would look like:
"gal$syncToken": {
"$t": "0_1001_17011_AAN3FFNH2AEJ3SFBKZDRS36AHRXHND47YACXLGFJF5QBXCSQLUK57EX3LC765CU5IWG6ZXWHPS5WKHSDFJ26LRI5FRIVIQ3Z532PWKG3ZG45JW3RVCDZMWK5LLLHZSCBTJH5U6Q4LZRG4PKWQE42AOIPC4VJCZQIP5MBJHNUBZZJNLKISKETTQ6DNTRAPTI"
},
Your syncToken will look different. To get the next page of results, Google actually provides a link that already has the syncToken pre-appended:
{
"rel": "next",
"type": "application/atom+xml",
"href": "https://www.google.com/m8/feeds/gal/example.com/full?sync-token=0_1001_17011_AAN3FFNH2AEJ3SFBKZDRS36AYRXHND47YACXLGFJF5QBXCSQLUK57EX3LC765CU5IWG6ZXWHPS5WKHSDFJ26LRI5FRIVIQ3Z562PWKG3ZG45JW3RVCDZMWK5LLLH6SCBTJH5U6Q4LZRG4PKWQE42AOIPC4VJCZQIP5MBJHNUBZZJNLKBSKETTQ6DNTRAPTI"
},
However, this will only give you the next 250 results. If you want more on each page, you can append the max-results parameter to this and have Google spit it back out in JSON format.
https://www.google.com/m8/feeds/gal/example.com/full?sync-token=INSERT_SYNCTOKEN_HERE&alt=json&max-results=10000
Hope this helped anyone seeing this. The Google GAL seems to be largely undocumented for the most part and I was unable to find an answer to this question anywhere else on the internet. If anyone from Google can confirm that this is the best method for accomplishing this that would be great!

Resources