achievements-app / psn-api

A JavaScript library that lets you get trophy, user, and game data from the PlayStation Network.
https://psn-api.achievements.app
MIT License
263 stars 31 forks source link

How to set trophyGroupId for getUserTitles request ? #110

Closed landscht closed 1 year ago

landscht commented 1 year ago

Hello!

I see in your documentation that for the getUserTitles query you specify "To retrieve trophies from all groups within a title (ie. the full trophy set), then trophyGroupId should be set to 'all'". Based on the answer to this query the percentage shows me the progress on all groups. I would like to know if it is possible to set the trophyGroupId to 'default' so that when we have the progress on the main game.

Thank you!

wescopeland commented 1 year ago

Hi @landscht ,

Sorry, after triple checking this is actually a documentation mistake on my part. It turns out this kind of querying is unsupported by this particular PSN endpoint. This endpoint can only retrieve the list of summarized user progress. After this list is retrieved, for deep progress, subsequent API calls must be used. The one you're looking for is probably getUserTrophiesEarnedForTitle.

This does usually end up resulting in a lot of calls, especially if the user has a ton of games! For some of my other projects, I built a job queueing system with BullMQ to manage this.

I will update this documentation after work today and leave this issue open until that is done.

wescopeland commented 1 year ago

Docs updated via https://github.com/achievements-app/psn-api/pull/111. I've also included a note about subsequent calls w/ getUserTrophiesEarnedForTitle.