JavaScript is required to use Bungie.net

Forums

originally posted in:BungieNetPlatform
8/28/2015 3:18:30 AM
11
There's a few ways to skin this cat, but my recommendation would be GroupServices:GetMembersOfClan. It's paged, but so is everything in groups these days. Platform/Groups/{groupId}/ClanMembers/ Accepts the following querystring parameters: platformType: 1 = XBox, 2 = PSN currentPage: the page # to return memberType: Omit this and you'll get everyone, which I recommend. Otherwise you can filter by whether they're a founder, admin, or just a member. There's also a deprecated sort parameter. Don't bother using it, it's a long story but you can't really choose meaningful sorting options for now. This will return you information both about their bnet membership if it's exposed, and their Destiny account info if it's exposed. You're still subject to privacy checks, so you can't get that info if someone has marked the association as private in their account.
English

Posting in language:

 

Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • How would I get the {groupId} in Platform/Groups/{groupId}/ClanMembers/? If I have the clanTag, which is "AGG", how would I get the groupId? We want to get all users who are part of the clan with clanTag of "AGG".

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Ahh - unfortunately we don't expose a service at this time that lets you find groups based on clan tags... but that does seem like it'd be a useful feature! Unfortunately, your only recourse at this moment would be to actually know the page of the group, and thus you could determine the group ID by looking in the URL of their group page. Not exactly something automatable... I will bring up the idea of allowing for search by clan tag!

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Thanks! How do you handle the paging of the results? In the API above currentPage is the only option. Is this indexed on 0 or 1? Do you just keep paging till you get no results if you want to get all results?

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Yes, so currentPage is one-based: the vast majority of our paged services are 1-based... I believe Forums and possibly Friends are the only services that aren't if I recall correctly. It's a long story. ;) Anyways, my recommendation would be if you do want to get all pages to do as you mentioned - continue paging until you get no results. If you can avoid it however, I'd recommend not preemptively attempting to get all of the pages of results: allowing your site/app to request pages on demand instead of trying to get it all at once will save both you and us bandwidth and processing if you can avoid it for your use case.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Thanks! I discovered response.results.totalResults which lets you know how many pages to iterate through. This can be used as a pseudo proxy for changes too. ie I iterate over the list once and save this in my app. When I need to perform an operation I can check the total to see if it has changed. If not, I don't need to pull the data. There is the edge case of an add and a delete happening in between checks so the total count remains the same, but I think I can live with that for now. In a perfect world you would expose a last update timestamp in the results, so you could see the last time the clan member list was updated and only reread on a change. Even better a notification service on changes <8-) even an rss feed of clan changes would be very useful.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Ooh, so totalResults is... interesting. This is a failing of some legacy mechanics in our API, but due to certain internal technical reasons I encourage people to not trust the totalResults property. There are some services for which it works for now, but most services have deprecated this field - and it's very likely that the field will be deprecated globally in the future. There may come a time where it will be guaranteed correct in the future, but for now I wouldn't build a system trusting in the correctness of totalResults in any service. I apologize for this inconvenience.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Gotcha, I actually ended up handling the paging by using a while loop and checking the hasMore attribute. I will add my own counter based on your feedback. So it seems that the ids''s returned here are the bungie ids and not the destiny ids'. So there is no easy way to go from the members returned here to their destiny chars. You can assume a reasonable percent have the same char name so you can do an account lookup on eaach result from this and see what you get buts its not 100% effective. I started this as a hobby project to learn some new tools (Google Appengine, Python and Jinja) and the original though was to create a clan based site where you could see your clanmembers, build some leaderboards and also build some in clan match making. I always wondered why this wasn't already here but perhaps I am stumbling on the answer here <8-)

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Yes, hasMore is the best option there for sure! Clan leaderboards involves making a lot of intensive calls to a wide variety of systems: this is a significant reason why we don't have "official" leaderboards at the moment. There may come a day where this will be more feasible to handle at scale, and at that time there will be better services available both for your consumption and for ours! In regards to the missing destiny ID - check the clan member's "destinyUserInfo.membershipId" and "destinyUserInfo.membershipType" properties - that is the membership ID and membership Type of the Destiny account linked to that user. If you don't see that data for that user, this means the user has marked that linked account as private and you won't be able to get at it through any reasonable means. (indeed, you could do that guessing you mentioned above, but I would highly discourage that: that's going to tend to be error prone both with false positives and false negatives... if someone wants their linkage to be private, you should let them keep it private and ignore them in your leaderboard processing) Indeed, you'd have to make additional calls to get their characters - and with that you can see how resource intensive making Clan Leaderboards are both for you and for us. ;)

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • It sounds like you're trying to store a local copy of clan membership data. This sounds like it could be fraught with errors and edge cases, one of which you've already pointed out. Is there a specific reason why you want to store the data locally as opposed to requesting the data directly from bnet when needed (similar to how the web and mobile companion clients behave)?

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Was thinking about this purely from an optimization perspective. This data is reasonably static and its very verbose so why not cut optimize by building a local cache.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

  • Depending on what data you are caching and what you plan to do with it, I would suggest not leveraging any kind of long-term cache. You'd essentially be replicating the data that bnet already manages in a centralized location, adding complexity on your end to try and keep everything in sync. A short-term cache for repeated requests sounds more reasonable, optimizing a small time window when the probability of data churn is very low (I believe the mobile clients do this quite a bit). That's just my thought, though.

    Posting in language:

     

    Play nice. Take a minute to review our Code of Conduct before submitting your post. Cancel Edit Create Fireteam Post

You are not allowed to view this content.
;
preload icon
preload icon
preload icon