diff --git a/README.md b/README.md index 9100818..4a7831d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # PlayStation Trophies -Sony has an API for retrieving details of the trophies an account has earned, but there is no public documentation for using it. This is an attempt at documenting the API by capturing the requests made by the https://my.playstation.com web site when browsing the trophy data of a PSN account. +Sony has an API for retrieving details of the trophies an account has earned, but there is no public documentation for using it. This is an attempt at documenting the API by capturing the requests made by the https://my.playstation.com web site (now retired) when browsing the trophy data of a PSN account, and through analysis of the PlayStation mobile app. This documentation can be viewed in a more friendly format at https://andshrew.github.io/PlayStation-Trophies/#/ courtesy of [GitHub Pages](https://pages.github.com/) and [docsify](https://docsify.js.org/#/). \ No newline at end of file diff --git a/docs/APIv2.md b/docs/APIv2.md index 63078a2..c974f61 100644 --- a/docs/APIv2.md +++ b/docs/APIv2.md @@ -2,7 +2,7 @@ With the release of the PlayStation 5 Sony has implemented a revised API for retrieving details of the trophies an account has earned. -This revision of the API is the only way to retrieve trophies for PS5 titles. It is fully backwards compatible and capable for retrieving trophy data associated with tiles on legacy platforms (ie. PS3, PS4 and PS Vita). +This revision of the API is the only way to retrieve trophies for PS5 and PC titles. It is fully backwards compatible and capable of retrieving trophy data associated with tiles on legacy platforms (ie. PS3, PS4 and PS Vita). ## Overview * Accessing the API requires authentication with a PSN account. @@ -61,13 +61,13 @@ The results are presented in order of the `lastUpdatedDateTime` for the title, s | Attribute | Type | Example Response | Description | | --- | --- |--- | --- | -| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 platform +| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 or PC platform | npCommunicationId | String | `NPWR20188_00` | Unique ID of the title; later required for requesting detailed trophy information for this title | trophySetVersion | String | `01.40` | The current version of the trophy set | trophyTitleName | String | `ASTRO’s PLAYROOM` | Title name | trophyTitleDetail | String | `RESIDENT EVIL 5 Trophy Set` | Title description
**PS3, PS4 and PS Vita titles only** | trophyTitleIconUrl | String | `https://...` | URL of the icon for the title -| trophyTitlePlatform | String | `PS5`
`PS4` | The platform this title belongs to. Some games have trophy sets which are shared between multiple platforms (ie. PS4,PSVITA). The platforms will be comma separated. +| trophyTitlePlatform | String | `PS5`
`PS4` | The platform this title belongs to. Some games have trophy sets which are shared between multiple platforms (ie. PS4,PSVITA or PS5,PSPC). The platforms will be comma separated. | hasTrophyGroups | Boolean | `true` | True if the title has multiple groups of trophies (eg. DLC trophies which are separate from the main trophy list) | definedTrophies | [JSON object](#trophy-titles-definedTrophies-json-objects) | | Number of trophies for the title by type | progress | Numeric | 100 | Percentage of trophies earned for the title @@ -219,7 +219,7 @@ A request to this URL will retrieve the individual trophy detail of a single - o | --- | --- | --- | --- | --- | | npCommunicationId | String | `NPWR20188_00` | Unique ID of the title | Yes | trophyGroupId | String | `all`
`default`
`001` | `all` to return all trophies for the title, otherwise restrict results to a specific trophy group | Yes -| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 platform | No, unless title platform is PS3, PS4 or PS Vita then **must** be `trophy` +| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 or PC platform | No, unless title platform is PS3, PS4 or PS Vita then **must** be `trophy` | limit | Numeric
**Min** 1
**Max** > 400
**Default** All trophies | `20` | Limit the number of trophies returned
*If no limit is specified all trophies will be returned* | No | | offset | Numeric
**Min** 0
**Max** `totalItemCount` - 1
**Default** 0 | `20` | Returns trophy data from this result onwards | No | @@ -378,7 +378,7 @@ This endpoint returns the earned status of the trophy only and no additional des | accountId | String | `me`
`12340..` | The account whos trophy list is being accessed
Use `me` for the authenticating account | Yes | npCommunicationId | String | `NPWR20188_00` | Unique ID of the title | Yes | trophyGroupId | String | `all`
`default`
`001` | `all` to return all trophies for the title, otherwise restrict results to a specific trophy group | Yes -| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 platform | No, unless title platform is PS3, PS4 or PS Vita then **must** be `trophy` +| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 or PC platform | No, unless title platform is PS3, PS4 or PS Vita then **must** be `trophy` | limit | Numeric
**Min** 1
**Max** > 400
**Default** All trophies | `20` | Limit the number of trophies returned
*If no limit is specified all trophies will be returned* | No | | offset | Numeric
**Min** 0
**Max** `totalItemCount` - 1
**Default** 0 | `20` | Returns trophy data from this result onwards | No | @@ -682,7 +682,7 @@ You can make a request to this URL for a specific title - using the unique `npCo | Parameter | Type | Example Value | Description | Required | | --- | --- | --- | --- | --- | | npCommunicationId | String | `NPWR10600_00` | Unique ID of the title | Yes -| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 platform | No, unless title platform is PS3, PS4 or PS Vita then **must** be `trophy` +| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 or PC platform | No, unless title platform is PS3, PS4 or PS Vita then **must** be `trophy` #### Output JSON Response @@ -692,7 +692,7 @@ You can make a request to this URL for a specific title - using the unique `npCo | trophyTitleName | String | `ASTRO’s PLAYROOM` | Title name | trophyTitleDetail | String | `RESIDENT EVIL 5 Trophy Set` | Title description
**PS3, PS4 and PS Vita titles only** | trophyTitleIconUrl | String | `https://...` | URL of the icon for the trophy title -| trophyTitlePlatfrom | String | `PS5` | The platform this title belongs to. Some games have trophy sets which are shared between multiple platforms (ie. PS4,PSVITA). The platforms will be comma separated. +| trophyTitlePlatfrom | String | `PS5` | The platform this title belongs to. Some games have trophy sets which are shared between multiple platforms (ie. PS4,PSVITA or PS5,PSPC). The platforms will be comma separated. | definedTrophies | [JSON object](#trophy-groups-definedtrophies-json-objects) | | Total number of trophies for the title by type | trophyGroups | [JSON object](#trophy-groups-trophygroups-json-objects) | | Individual object for each trophy group returned @@ -772,6 +772,56 @@ Executing this example using Powershell - see [Querying the API](#powershell-7) ```powershell Invoke-RestMethod -Uri "https://m.np.playstation.com/api/trophy/v1/npCommunicationIds/NPWR20188_00/trophyGroups" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 3 ``` +**Example 2 - Retrieve trophy groups for PS5 and PC title Ghost of Tsushima** + + https://m.np.playstation.com/api/trophy/v1/npCommunicationIds/NPWR22859_00/trophyGroups + +```json +{ + "npServiceName": "trophy2", + "npCommunicationId": "NPWR22859_00", + "trophySetVersion": "01.25", + "trophyTitleName": "Ghost of Tsushima", + "trophyTitleIconUrl": "https://psnobj.prod.dl.playstation.net/psnobj/NPWR22859_00/d7213b2e-8048-40ae-859e-3ce1863b9390.png", + "trophyTitlePlatform": "PS5,PSPC", + "definedTrophies": { + "bronze": 59, + "silver": 13, + "gold": 4, + "platinum": 1 + }, + "trophyGroups": [ + { + "trophyGroupId": "default", + "trophyGroupName": "Ghost of Tsushima", + "trophyGroupIconUrl": "https://psnobj.prod.dl.playstation.net/psnobj/NPWR22859_00/d7213b2e-8048-40ae-859e-3ce1863b9390.png", + "definedTrophies": { + "bronze": 40, + "silver": 9, + "gold": 2, + "platinum": 1 + } + }, + { + "trophyGroupId": "001", + "trophyGroupName": "Ghost of Tsushima: Legends Mode", + "trophyGroupIconUrl": "https://psnobj.prod.dl.playstation.net/psnobj/NPWR22859_00/5da15285-93ab-4779-95ef-88278098be11.png", + "definedTrophies": { + "bronze": 3, + "silver": 2, + "gold": 1, + "platinum": 0 + } + } + <#-- truncated --#> + ] +} +``` +Executing this example using Powershell - see [Querying the API](#powershell-7) +```powershell +Invoke-RestMethod -Uri "https://m.np.playstation.com/api/trophy/v1/npCommunicationIds/NPWR22859_00/trophyGroups" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 3 +``` + ### Summary of Trophies Earned by Trophy Group https://m.np.playstation.com/api/trophy/v1/users/{accountId}/npCommunicationIds/{npCommunicationId}/trophyGroups @@ -792,7 +842,7 @@ This endpoint returns the earned summary of the title and its trophy groups only | --- | --- | --- | --- | --- | | accountId | String | `me`
`12340..` | The account whos trophy list is being accessed
Use `me` for the authenticating account | Yes | npCommunicationId | String | `NPWR20188_00` | Unique ID of the title | Yes -| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 platform | No, unless title platform is PS3, PS4 or PS Vita then **must** be `trophy` +| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 or PC platform | No, unless title platform is PS3, PS4 or PS Vita then **must** be `trophy` #### Output JSON Response @@ -991,7 +1041,7 @@ This endpoint can be used as a way of linking the `npCommunicationId` of a Troph | Attribute | Type | Example Response | Description | | --- | --- |--- | --- | -| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 platform +| npServiceName | String | `trophy`
`trophy2` | `trophy` for PS3, PS4, or PS Vita platforms
`trophy2` for the PS5 or PC platform | npCommunicationId | String | `NPWR20004_00` | Unique ID of the trophy set | trophyTitleName | String | `Returnal` | Title name | trophyTitleDetail | String | `RESIDENT EVIL 5 Trophy Set` | Title description
**PS3, PS4 and PS Vita titles only** @@ -1256,13 +1306,15 @@ Executing this example using Powershell - see [Querying the API](#powershell-7) Invoke-RestMethod -Uri "https://m.np.playstation.com/api/trophy/v1/users/me/titles/trophyTitles?includeNotEarnedTrophyIds=true&npTitleIds=CUSA09171_00%2CPPSA01284_00%2CPPSA04874_00" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 ``` -## PS+ Game Help +## Game Help Endpoints -The updated trophy system which launched with the PlayStation 5 included a new PlayStation Plus subscriber benefit called Game Help. It provides tips and guides on how to complete specific trophies. This information was initially only accessible via the trophy list or activity cards on the console itself, however the PlayStation App was updated in May 2023 (v23.5.0) to include support for accessing the Game Help associated with trophies (activity card Game Help remains only accessible on console). +The updated trophy system which launched with the PlayStation 5 included a new PlayStation Plus subscriber benefit called Game Help. It provides tips and guides on how to complete specific trophies. This information was initially only accessible via the trophy list or activity cards on the console itself, however the PlayStation App was updated in May 2023 (v23.5.0) to include support for accessing the Game Help associated with trophies (activity card Game Help remains only accessible on console). + +As of [early 2024 Game Help no longer requires a PS+ subscription](https://blog.playstation.com/2024/03/26/introducing-community-game-help-a-new-enhancement-for-game-help-powered-by-user-generated-content/) and is now available to all PS5 players. There are two main endpoints for this function: - * Request a list of trophies for a specific title which have Game Help available (accessible from all accounts). - * Request the Game Help that is available for a specific trophy (only accessible to accounts which have a PS+ subscription). + * Request a list of trophies for a specific title which have Game Help available. + * Request the Game Help that is available for a specific trophy. The Game Help can come in the form of written descriptions for how to earn a trophy, or it can be in the form of a video guide. When a video is used the API response includes the URL to a HLS video stream, along with a short lived access token granting access to the file. The stream includes resolutions up to 1080p. It can be viewed in applications such as VLC media player, or downloaded with applications like ffmpeg or JDownloader 2. @@ -1287,6 +1339,15 @@ You can check against all trophies, or you can limit the request to only check a | npCommId | variables | String | `NPWR20188_00` | Unique ID of the title | Yes | trophyIds | variables | Array
String | `["0", "1"]` | Limit request to these specific trophy IDs | No +##### Additional Headers + +Requests to this endpoint must include additional headers in the request. + +| Key | Value | +| --- | --- | +| apollographql-client-name | PlayStationApp-Android | +| content-type | application/json | + #### Output JSON Response A JSON response is returned. The following are returned under the `data` attribute. @@ -1486,7 +1547,7 @@ A JSON response is returned. The following are returned under the `data` attribu Executing this example using Powershell - see [Querying the API](#powershell-7) ```powershell -Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetHintAvailability&variables={"npCommId":"NPWR20188_00"}&extensions={"persistedQuery":{"version":1,"sha256Hash":"71bf26729f2634f4d8cca32ff73aaf42b3b76ad1d2f63b490a809b66483ea5a7"}}' -Authentication Bearer -Token $token | ConvertTo-Json -Depth 5 +Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetHintAvailability&variables={"npCommId":"NPWR20188_00"}&extensions={"persistedQuery":{"version":1,"sha256Hash":"71bf26729f2634f4d8cca32ff73aaf42b3b76ad1d2f63b490a809b66483ea5a7"}}' -Headers @{"apollographql-client-name"="PlayStationApp-Android";"content-type"="application/json"} -Authentication Bearer -Token $token | ConvertTo-Json -Depth 5 ``` **Example 2 - Check if trophies 18, 19 and 21 from PS5 title ASTRO’s PLAYROOM have Game Help available** @@ -1521,15 +1582,13 @@ Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operation Executing this example using Powershell - see [Querying the API](#powershell-7) ```powershell -Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetHintAvailability&variables={"npCommId":"NPWR20188_00","trophyIds":["18", "19", "21"]}&extensions={"persistedQuery":{"version":1,"sha256Hash":"71bf26729f2634f4d8cca32ff73aaf42b3b76ad1d2f63b490a809b66483ea5a7"}}' -Authentication Bearer -Token $token | ConvertTo-Json -Depth 5 +Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetHintAvailability&variables={"npCommId":"NPWR20188_00","trophyIds":["18", "19", "21"]}&extensions={"persistedQuery":{"version":1,"sha256Hash":"71bf26729f2634f4d8cca32ff73aaf42b3b76ad1d2f63b490a809b66483ea5a7"}}' -Headers @{"apollographql-client-name"="PlayStationApp-Android";"content-type"="application/json"} -Authentication Bearer -Token $token | ConvertTo-Json -Depth 5 ``` ### Retrieve Game Help for a Trophy https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetTips -!> The authenticating PSN account must have a PS+ subscription to access this endpoint - Requests to this URL will retrieve the Game Help which is available for a specific trophy. An array of trophies can be submitted within the `variables` parameter to retrieve multiple at once. @@ -1549,6 +1608,15 @@ An array of trophies can be submitted within the `variables` parameter to retrie | udsObjectId | variables | String | `GATCHA_SECRET` | ID of the Game Help | Yes | helpType | variables | String | `helpType` | Type of Game Help | Yes +##### Additional Headers + +Requests to this endpoint must include additional headers in the request. + +| Key | Value | +| --- | --- | +| apollographql-client-name | PlayStationApp-Android | +| content-type | application/json | + #### Output JSON Response A JSON response is returned. The following are returned under the `data` attribute. @@ -1641,7 +1709,7 @@ A JSON response is returned. The following are returned under the `data` attribu Executing this example using Powershell - see [Querying the API](#powershell-7) ```powershell -Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetTips&variables={"npCommId":"NPWR20188_00","trophies":[{"trophyId":"18","udsObjectId":"GATCHA_SECRET","helpType":"HINT"}]}&extensions={"persistedQuery":{"version":1,"sha256Hash":"93768752a9f4ef69922a543e2209d45020784d8781f57b37a5294e6e206c5630"}}' -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 +Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetTips&variables={"npCommId":"NPWR20188_00","trophies":[{"trophyId":"18","udsObjectId":"GATCHA_SECRET","helpType":"HINT"}]}&extensions={"persistedQuery":{"version":1,"sha256Hash":"93768752a9f4ef69922a543e2209d45020784d8781f57b37a5294e6e206c5630"}}' -Headers @{"apollographql-client-name"="PlayStationApp-Android";"content-type"="application/json"} -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 ``` **Example 2 - Retrieve the Game Help for a trophy where the help includes multiple steps to complete** @@ -1696,7 +1764,7 @@ Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operation Executing this example using Powershell - see [Querying the API](#powershell-7) ```powershell -Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetTips&variables={"npCommId":"NPWR20842_00","trophies":[{"trophyId":"21","udsObjectId":"Weapon_to_Level_5","helpType":"HINT"}]}&extensions={"persistedQuery":{"version":1,"sha256Hash":"93768752a9f4ef69922a543e2209d45020784d8781f57b37a5294e6e206c5630"}}' -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 +Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetTips&variables={"npCommId":"NPWR20842_00","trophies":[{"trophyId":"21","udsObjectId":"Weapon_to_Level_5","helpType":"HINT"}]}&extensions={"persistedQuery":{"version":1,"sha256Hash":"93768752a9f4ef69922a543e2209d45020784d8781f57b37a5294e6e206c5630"}}' -Headers @{"apollographql-client-name"="PlayStationApp-Android";"content-type"="application/json"} -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 ``` **Example 3 - Retrieve the Game Help for trophy 18 and 45 in PS5 title ASTRO’s PLAYROOM** @@ -1766,7 +1834,7 @@ Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operation Executing this example using Powershell - see [Querying the API](#powershell-7) ```powershell -Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetTips&variables={"npCommId":"NPWR20188_00","trophies":[{"trophyId":"18","udsObjectId":"GATCHA_SECRET","helpType":"HINT"}, {"trophyId":"45","udsObjectId":"DAY1__GRAVITY_DAZE","helpType":"HINT"}]}&extensions={"persistedQuery":{"version":1,"sha256Hash":"93768752a9f4ef69922a543e2209d45020784d8781f57b37a5294e6e206c5630"}}' -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 +Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetTips&variables={"npCommId":"NPWR20188_00","trophies":[{"trophyId":"18","udsObjectId":"GATCHA_SECRET","helpType":"HINT"}, {"trophyId":"45","udsObjectId":"DAY1__GRAVITY_DAZE","helpType":"HINT"}]}&extensions={"persistedQuery":{"version":1,"sha256Hash":"93768752a9f4ef69922a543e2209d45020784d8781f57b37a5294e6e206c5630"}}' -Headers @{"apollographql-client-name"="PlayStationApp-Android";"content-type"="application/json"} -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 ``` # Querying the API diff --git a/docs/README.md b/docs/README.md index 0f59759..f729adf 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,7 +9,18 @@ These APIs have been documented by by capturing the requests made by the https:/ * [PlayStation Trophies API v1](APIv1.md) * Supported platforms PS4, PS3 and PS Vita * [PlayStation Trophies API v2](APIv2.md) - * Supported platforms PS5, PS4, PS3 and PS Vita + * Supported platforms PS5, PC, PS4, PS3 and PS Vita + +## Miscellaneous API Endpoints + +This section of the documentation contains documentation on additional API endpoints not strictly related to the trophy system, but which may be of interest. + +* [Miscellaneous API Endpoints](/misc/) + * [User Profile](/misc/UserProfile) + * [User Games](/misc/UserGames) + * [Console Information](/misc/Console) + * [PlayStation Store](/misc/Store) + * [Search](/misc/Search) ## Additional Thanks diff --git a/docs/_footer.md b/docs/_footer.md new file mode 100644 index 0000000..d37450a --- /dev/null +++ b/docs/_footer.md @@ -0,0 +1,7 @@ +--- +This website is not affiliated with PlayStation or Sony Interactive Entertainment Inc. + +[PlayStation Trophies API Documentation](https://andshrew.github.io/PlayStation-Trophies/#/) by [andshrew](https://github.com/andshrew) is licensed under the [MIT License](https://github.com/andshrew/PlayStation-Trophies/blob/master/LICENSE) + +View and contribute to the documentation on GitHub: +https://github.com/andshrew/PlayStation-Trophies \ No newline at end of file diff --git a/docs/_navbar.md b/docs/_navbar.md index 49317d8..8300824 100644 --- a/docs/_navbar.md +++ b/docs/_navbar.md @@ -4,5 +4,6 @@ * [v1](APIv1.md) * [v2](APIv2.md) * Other APIs + * [Miscellaneous APIs](/misc/) * [PlayStation Stars](https://andshrew.github.io/PlayStation-Stars/) * [PS5 Backwards Compatibility](https://andshrew.github.io/supreme-enigma) \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 93b18b5..c76b5a2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -16,6 +16,7 @@ name: 'PlayStation Trophies API Documentation', repo: 'https://github.com/andshrew/PlayStation-Trophies/', loadNavbar: true, + loadFooter: true, auto2top: true, copyCode: { buttonText : 'Copy to clipboard', @@ -40,5 +41,7 @@ + + \ No newline at end of file diff --git a/docs/misc/Console.md b/docs/misc/Console.md new file mode 100644 index 0000000..7d2ff83 --- /dev/null +++ b/docs/misc/Console.md @@ -0,0 +1,221 @@ +## Console Storage Usage + + https://m.np.playstation.com/api/cloudAssistedNavigation/v2/users/me/clients + +This endpoint returns a list of installed content on your console. It works with PS5, and _may_ work with PS4 storage too. It _may_ also require that you have your Data Sharing settings with Sony set to Full rather than Limited. + +It includes information such as what content is installed, where it is installed (ie. internal, USB, M.2), and how much space it occupies in bytes. + +The endpoint can only query the authenticating account. + +### Input Parameters + +| Parameter | Type | Example Value | Description | Required | +| --- | --- | --- | --- | --- | +| includeFields | String | `device,systemData` | Comma separated list of fields to return | Yes +| platform | String | `PS5` | Console type | Yes + +#### Additional Headers + +Requests to this endpoint must include additional headers in the request. + +| Key | Value | +| --- | --- | +| Accept-Language | `en-gb`
`en-us`
`de-de` | + +### Output JSON Response + +A JSON response is returned. As a large amount of information is returned that is mostly self explanatory, I've only included observations here that may be of interest. + +Under the `systemData` attribute, the title data returned seems to belong to content that has been streamed via PS+ Premium. The `lastAccessDateTime` does not seem to be accurate to when the game was last streamed. + +Under the `installedTitles` attribute, the title data returned seems to belong to content that is actually installed on the console. Unlike the above, `lastAccessDateTime` does seem to be accurate, however it may be influenced by when the console performs an auto update check on the title (or even other factors like viewing the games title in the library) and so doesn't seem to be when the title was last launched. + +The `version` for PS4 content does not seem to be accurate, almost all of mine are listed as version `01.00`. The version numbers for PS5 content do seem to be accurate. + +Under the `storage` attribute, `embedded` is the PS5 built in storage, `mounted` is external USB storage, and `m2Extended` is the M.2 drive in the expansion slot. + +### Example URL and Response + + https://m.np.playstation.com/api/cloudAssistedNavigation/v2/users/me/clients?includeFields=device%2CsystemData&platform=PS5 + +```json +{ + "clients": [ + { + "device": { + "language": "en-GB", + "name": "PS5", + "updatedDateTime": "2024-08-25T05:49:20.245Z", + "wakeupEnabledPowerModes": [ + "networkStandby", + "mainOnStandby" + ], + "enabledFeatures": [] + }, + "duid": "0000000example", + "platform": "PS5", + "deviceProperties": [], + "systemData": { + "icons": { + "titles": [ + { + "comment": "Horizon Forbidden West", + "conceptId": "10000886", + "contentPriority": "prior", + "contentType": "cloudGame", + "displayLocationSpace": "game", + "lastAccessDateTime": "2024-08-23T10:50:29.172Z", + "npTitleId": "PPSA01521_00", + "psPlatform": "PS5", + "titleId": "PPSA01521" + }, + { + "comment": "Resident Evil: The Darkside Chronicles", + "contentPriority": "prior", + "contentType": "cloudGame", + "displayLocationSpace": "game", + "lastAccessDateTime": "2024-08-23T10:50:28.827Z", + "npTitleId": "NPEB00816_00", + "psPlatform": "PS3", + "titleId": "NPEB00816" + }, + { + "comment": "Ratchet & Clank™: Tools of Destruction", + "contentPriority": "prior", + "contentType": "cloudGame", + "displayLocationSpace": "game", + "lastAccessDateTime": "2024-08-23T10:50:28.807Z", + "npTitleId": "NPEA00452_00", + "psPlatform": "PS3", + "titleId": "NPEA00452" + }, + { + "comment": "Assassin's Creed® IV Black Flag", + "conceptId": "200089", + "contentPriority": "prior", + "contentType": "cloudGame", + "displayLocationSpace": "game", + "lastAccessDateTime": "2024-08-23T10:50:26.070Z", + "npTitleId": "CUSA00009_00", + "psPlatform": "PS4", + "titleId": "CUSA00009" + } + ], + "updatedDateTime": "2024-08-25T05:49:28.110Z" + }, + "installedTitles": { + "titles": [ + { + "comment": "Rocket League®", + "conceptId": "203715", + "contentPriority": "prior", + "disc": "inapplicable", + "displayLocationSpace": "game", + "lastAccessDateTime": "2024-08-24T20:00:55.716Z", + "npTitleId": "CUSA01433_00", + "psPlatform": "PS4", + "size": 34034458624, + "storage": "mounted", + "titleId": "CUSA01433", + "version": "01.00" + }, + { + "comment": "Diablo III: Reaper of Souls – Ultimate Evil Edition", + "conceptId": "200914", + "contentPriority": "prior", + "disc": "unavailable", + "displayLocationSpace": "game", + "lastAccessDateTime": "2022-08-20T10:30:25.000Z", + "npTitleId": "CUSA00433_00", + "psPlatform": "PS4", + "size": 52076470272, + "storage": "mounted", + "titleId": "CUSA00433", + "version": "01.00" + }, + { + "comment": "Call of Duty®", + "conceptId": "10001130", + "contentPriority": "prior", + "disc": "inapplicable", + "displayLocationSpace": "game", + "lastAccessDateTime": "2024-08-25T16:30:11.216Z", + "npTitleId": "PPSA07950_00", + "psPlatform": "PS5", + "size": 155862171648, + "storage": "m2Extended", + "titleId": "PPSA07950", + "version": "01.050.000" + }, + { + "comment": "Diablo IV", + "conceptId": "231761", + "contentPriority": "prior", + "disc": "inapplicable", + "displayLocationSpace": "game", + "lastAccessDateTime": "2024-08-25T09:26:43.429Z", + "npTitleId": "PPSA08595_00", + "psPlatform": "PS5", + "size": 91380973568, + "storage": "m2Extended", + "titleId": "PPSA08595", + "version": "01.054.000" + }, + { + "comment": "ASTRO's PLAYROOM", + "conceptId": "10000229", + "contentPriority": "prior", + "disc": "inapplicable", + "displayLocationSpace": "game", + "lastAccessDateTime": "2024-08-23T10:51:01.419Z", + "npTitleId": "PPSA01325_00", + "psPlatform": "PS5", + "size": 11672813568, + "storage": "embedded", + "titleId": "PPSA01325", + "version": "01.902.000" + }, + { + "comment": "YouTube", + "conceptId": "205453", + "contentPriority": "prior", + "disc": "inapplicable", + "displayLocationSpace": "media", + "lastAccessDateTime": "2024-08-23T10:50:29.238Z", + "npTitleId": "PPSA01651_00", + "psPlatform": "PS5", + "size": 472842240, + "storage": "embedded", + "titleId": "PPSA01651", + "version": "01.000.007" + } + ], + "updatedDateTime": "2024-08-25T21:04:56.229Z" + }, + "storage": { + "embedded": { + "freeSize": 57282658304, + "totalSize": 667176337408 + }, + "m2Extended": { + "freeSize": 870432178176, + "totalSize": 4000760987648 + }, + "mounted": { + "freeSize": 1240872239104, + "totalSize": 3673362489344 + }, + "updatedDateTime": "2024-08-25T20:47:50.956Z" + } + }, + "updatedDateTime": "2024-08-19T19:14:44.272Z", + "version": "7" + } + ] +} +``` +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri "https://m.np.playstation.com/api/cloudAssistedNavigation/v2/users/me/clients?includeFields=device,systemData&platform=PS5" -Headers @{"Accept-Language"="en-gb"} -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 +``` \ No newline at end of file diff --git a/docs/misc/README.md b/docs/misc/README.md new file mode 100644 index 0000000..9e5e215 --- /dev/null +++ b/docs/misc/README.md @@ -0,0 +1,9 @@ +# Miscellaneous API Endpoints + +This section of the documentation contains various API endpoints not strictly related to the trophy system, but which may still be of interest. + +* [User Profile](/misc/UserProfile) +* [User Games](/misc/UserGames) +* [Console Information](/misc/Console) +* [PlayStation Store](/misc/Store) +* [Search](/misc/Search) \ No newline at end of file diff --git a/docs/misc/Search.md b/docs/misc/Search.md new file mode 100644 index 0000000..5368453 --- /dev/null +++ b/docs/misc/Search.md @@ -0,0 +1,309 @@ +## Universal Search + + https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetContextSearchResults + +This endpoint can search for user accounts, or it can search the PlayStation Store. + +### Input Parameters + +| Parameter | Value +| --- | --- +| operationName | `metGetContextSearchResults` +| variables | `{"searchTerm":"username","searchContext":"MobileUniversalSearchSocial","displayTitleLocale":"en-US"}` +| extensions | `{"persistedQuery":{"version":1,"sha256Hash":"ac5fb2b82c4d086ca0d272fba34418ab327a7762dd2cd620e63f175bbc5aff10"}}` + +| Property | Parent Parameter | Type | Example Values | Description | Required | +| --- | --- | --- | --- | --- | --- | +| searchTerm | variables | String | `username`
`game name` | The username or PS Store content name to search for | Yes | +| searchContext | variables | String | `MobileUniversalSearchSocial`
`MobileUniversalSearchGame` | The type of search to perform | Yes | +| displayTitleLocale | variables | String | `en-US` | The language and country code of the store to search | Yes | + +#### Additional Headers + +Requests to this endpoint must include additional headers in the request. + +| Key | Value | +| --- | --- | +| apollographql-client-name | PlayStationApp-Android | +| content-type | application/json | + +### Example URLs and Responses + +#### Example 1 - Search for user account "username" + + https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetContextSearchResults&variables={"searchTerm":"username","searchContext":"MobileUniversalSearchSocial","displayTitleLocale":"en-US"}&extensions={"persistedQuery":{"version":1,"sha256Hash":"ac5fb2b82c4d086ca0d272fba34418ab327a7762dd2cd620e63f175bbc5aff10"}} + +```json +{ + "data": { + "universalContextSearch": { + "__typename": "UniversalContextSearchResponse", + "queryFrequency": { + "__typename": "QueryFrequency", + "filterDebounceMs": 1000, + "searchDebounceMs": 500 + }, + "results": [ + { + "__typename": "UniversalDomainSearchResponse", + "domain": "SocialAllAccounts", + "domainTitle": "Players", + "next": "eyJTTyI6MTV9", + "searchResults": [ + { + "__typename": "SearchResultItem", + "highlight": { + "__typename": "PlayerHighlight", + "firstName": null, + "lastName": null, + "middleName": null, + "onlineId": [ + "", + "Username" + ], + "verifiedUserName": null + }, + "id": "ABCxyz==", + "result": { + "__typename": "Player", + "accountId": "0000000000000000000", + "avatarUrl": "http://psn-rsc.prod.dl.playstation.net/psn-rsc/avatar/UT0016/CUSA06833_00-AV00000000000001_72E7CFC37BB24D706E60_l.png", + "displayName": "Username", + "displayNameHighlighted": [], + "firstName": null, + "id": "ABCxyz==", + "isPsPlus": false, + "itemType": "SOCIAL", + "lastName": null, + "middleName": null, + "onlineId": "Username", + "onlineIdHighlighted": [ + "", + "Username" + ], + "profilePicUrl": null, + "relationshipState": null + }, + "resultOriginFlag": null + }, + <#-- truncated --#> + "totalResultCount": 128, + "zeroState": false + } + ] + } + } +} +``` + +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetContextSearchResults&variables= +{"searchTerm":"username","searchContext":"MobileUniversalSearchSocial","displayTitleLocale":"en-US"}&extensions= +{"persistedQuery":{"version":1,"sha256Hash":"ac5fb2b82c4d086ca0d272fba34418ab327a7762dd2cd620e63f175bbc5aff10"}}' -Headers @{"apollographql-client-name"="PlayStationApp-Android";"content-type"="application/json"} -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 +``` + +#### Example 2 - Search for "batman" content on the PS Store + + https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetContextSearchResults&variables={"searchTerm":"batman","searchContext":"MobileUniversalSearchGame","displayTitleLocale":"en-US"}&extensions={"persistedQuery":{"version":1,"sha256Hash":"ac5fb2b82c4d086ca0d272fba34418ab327a7762dd2cd620e63f175bbc5aff10"}} + +```json +{ + "data": { + "universalContextSearch": { + "__typename": "UniversalContextSearchResponse", + "queryFrequency": { + "__typename": "QueryFrequency", + "filterDebounceMs": 1000, + "searchDebounceMs": 500 + }, + "results": [ + { + "__typename": "UniversalDomainSearchResponse", + "domain": "MobileGames", + "domainTitle": "Full Games", + "next": "CA8abQo6YWIzYjAzZDctZTZjZi00YjU3LWI2MzEtYzVjY2Y4MGYyMDIwLThOVG1SeWRKLTItMTcyNDY5NTIwMBIvc2VhcmNoLXJlbGV2YW5jeS1jb25jZXB0LWdhbWUtbWwtbW9kZWwtYmxhY2tleWUiHnNlYXJjaC5ub19leHBlcmltZW50Lm5vbi4wLm5vbioELTk0NA", + "searchResults": [ + { + "__typename": "SearchResultItem", + "highlight": { + "__typename": "ItemHighlight", + "name": [ + "", + "BATMAN", + "™: ARKHAM KNIGHT" + ] + }, + "id": "200472", + "result": { + "__typename": "Concept", + "defaultProduct": { + "__typename": "Product", + "id": "UP1018-CUSA00133_00-BATMANARKHAMKNHT", + "invariantName": "Batman™: Arkham Knight", + "itemType": "CONCEPTPRODUCT", + "localizedStoreDisplayClassification": "Full Game", + <#-- truncated --#> + "totalResultCount": 83, + "zeroState": false + } + ] + } + } +} +``` + +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetContextSearchResults&variables= +{"searchTerm":"batman","searchContext":"MobileUniversalSearchGame","displayTitleLocale":"en-US"}&extensions= +{"persistedQuery":{"version":1,"sha256Hash":"ac5fb2b82c4d086ca0d272fba34418ab327a7762dd2cd620e63f175bbc5aff10"}}' -Headers @{"apollographql-client-name"="PlayStationApp-Android";"content-type"="application/json"} -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 +``` + +## Universal Search Pagination + + https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetDomainSearchResults + +This endpoint compliments the main [Universal Search](#universal-search) and allows you to page through additional search results. It requires input parameters returned in the response to that endpoint. + +### Input Parameters + +| Parameter | Value +| --- | --- +| operationName | `metGetDomainSearchResults` +| variables | `{"searchTerm":"username","searchDomain":"SocialAllAccounts","nextCursor":"eyJTTyI6MTV9","pageSize":20,"pageOffset":40}` +| extensions | `{"persistedQuery":{"version":1,"sha256Hash":"23ece284bf8bdc50bfa30a4d97fd4d733e723beb7a42dff8c1ee883f8461a2e1"}}` + +| Property | Parent Parameter | Type | Example Values | Description | Required | +| --- | --- | --- | --- | --- | --- | +| searchTerm | variables | String | `username`
`game name` | The username or PS Store content name that was searched for | Yes | +| searchDomain | variables | String | `SocialAllAccounts`
`MobileGames` | The type of search that was performed | Yes | +| nextCursor | variables | String | `eyJTTyI6MTV9` | This was returned as part of the [Universal Search](#universal-search) response | Yes | +| pageSize | variables | Numeric | `20` | Number of results to return in the page | Yes | +| pageOffset | variables | Numeric | `40` | Unclear why an offset is required when a cursor position is being supplied with `nextCursor`, but requests from the app do increment this as it pages through results | Yes | + + +#### Additional Headers + +Requests to this endpoint must include additional headers in the request. + +| Key | Value | +| --- | --- | +| apollographql-client-name | PlayStationApp-Android | +| content-type | application/json | + +### Example URLs and Responses + +#### Example 1 - Get an additional page of search results for user account "username" + + https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetDomainSearchResults&variables={"searchTerm":"username","searchDomain":"SocialAllAccounts","nextCursor":"eyJTTyI6MTV9","pageSize":20,"pageOffset":100}&extensions={"persistedQuery":{"version":1,"sha256Hash":"23ece284bf8bdc50bfa30a4d97fd4d733e723beb7a42dff8c1ee883f8461a2e1"}} + +```json +{ + "data": { + "universalDomainSearch": { + "__typename": "UniversalDomainSearchResponse", + "domain": "SocialAllAccounts", + "domainTitle": "Players", + "next": "eyJTTyI6MzV9", + "searchResults": [ + { + "__typename": "SearchResultItem", + "highlight": { + "__typename": "PlayerHighlight", + "firstName": [ + "", + "username" + ], + "lastName": null, + "middleName": null, + "onlineId": [ + "", + "Username", + "" + ], + "verifiedUserName": null + }, + "id": "ABCxyz==", + "result": { + "__typename": "Player", + "accountId": "0000000000000000000", + "avatarUrl": "http://static-resource.np.community.playstation.net/avatar/WWS_E/E2100_l.png", + "displayName": "username", + "displayNameHighlighted": [ + "", + "username", + " ", + "", + "" + ], + "firstName": "username", + "id": "ABCxyz==", + "isPsPlus": false, + "itemType": "SOCIAL", + "lastName": null, + "middleName": null, + "onlineId": "Username", + "onlineIdHighlighted": [ + "", + "Username", + "" + ], + "profilePicUrl": "https://image.api.playstation.com/profile/images/filestore/...", + "relationshipState": null + }, + "resultOriginFlag": null + }, + <#-- truncated --#> + "totalResultCount": 128, + "zeroState": false + } + } +} +``` + +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetDomainSearchResults&variables={"searchTerm":"username","searchDomain":"SocialAllAccounts","nextCursor":"eyJTTyI6MTV9","pageSize":20,"pageOffset":100}&extensions={"persistedQuery":{"version":1,"sha256Hash":"23ece284bf8bdc50bfa30a4d97fd4d733e723beb7a42dff8c1ee883f8461a2e1"}}' -Headers @{"apollographql-client-name"="PlayStationApp-Android";"content-type"="application/json"} -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 +``` + +#### Example 2 - Get an additional page of search results for "batman" content on the PS Store + + https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetDomainSearchResults&variables={"searchTerm":"batman","searchDomain":"MobileGames","nextCursor":"CA8abQo6YWIzYjAzZDctZTZjZi00YjU3LWI2MzEtYzVjY2Y4MGYyMDIwLThOVG1SeWRKLTItMTcyNDY5NTIwMBIvc2VhcmNoLXJlbGV2YW5jeS1jb25jZXB0LWdhbWUtbWwtbW9kZWwtYmxhY2tleWUiHnNlYXJjaC5ub19leHBlcmltZW50Lm5vbi4wLm5vbioELTk0NA","pageSize":20,"pageOffset":20}&extensions={"persistedQuery":{"version":1,"sha256Hash":"23ece284bf8bdc50bfa30a4d97fd4d733e723beb7a42dff8c1ee883f8461a2e1"}} + +```json +{ + "data": { + "universalDomainSearch": { + "__typename": "UniversalDomainSearchResponse", + "domain": "MobileGames", + "domainTitle": "Full Games", + "next": "", + "searchResults": [ + { + "__typename": "SearchResultItem", + "highlight": { + "__typename": "ItemHighlight", + "name": null + }, + "id": "228618", + "result": { + "__typename": "Concept", + "defaultProduct": { + "__typename": "Product", + "id": "UP9000-CUSA01623_00-0000GODOFWAR3PS4", + "invariantName": "God of War III Remastered", + "itemType": "CONCEPTPRODUCT", + "localizedStoreDisplayClassification": "Full Game", + <#-- truncated --#> + "totalResultCount": 40, + "zeroState": false + } + } +} +``` + +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetDomainSearchResults&variables={"searchTerm":"batman","searchDomain":"MobileGames","nextCursor":"CA8abQo6YWIzYjAzZDctZTZjZi00YjU3LWI2MzEtYzVjY2Y4MGYyMDIwLThOVG1SeWRKLTItMTcyNDY5NTIwMBIvc2VhcmNoLXJlbGV2YW5jeS1jb25jZXB0LWdhbWUtbWwtbW9kZWwtYmxhY2tleWUiHnNlYXJjaC5ub19leHBlcmltZW50Lm5vbi4wLm5vbioELTk0NA","pageSize":20,"pageOffset":20}&extensions={"persistedQuery":{"version":1,"sha256Hash":"23ece284bf8bdc50bfa30a4d97fd4d733e723beb7a42dff8c1ee883f8461a2e1"}}' -Headers @{"apollographql-client-name"="PlayStationApp-Android";"content-type"="application/json"} -Authentication Bearer -Token $token | ConvertTo-Json -Depth 10 +``` \ No newline at end of file diff --git a/docs/misc/Store.md b/docs/misc/Store.md new file mode 100644 index 0000000..e661938 --- /dev/null +++ b/docs/misc/Store.md @@ -0,0 +1,103 @@ +## PlayStation Store Wishlist + + https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetStoreWishlist + +This endpoint retrieves a users PlayStation Store wishlist. + +The endpoint can only query the authenticating account. + +### Input Parameters + +| Parameter | Value +| --- | --- +| operationName | `metGetStoreWishlist` +| variables | `{}` +| extensions | `{"persistedQuery":{"version":1,"sha256Hash":"571149e8aa4d76af7dd33b92e1d6f8f828ebc5fa8f0f6bf51a8324a0e6d71324"}}` + +#### Additional Headers + +Requests to this endpoint must include additional headers in the request. + +| Key | Value | +| --- | --- | +| apollographql-client-name | PlayStationApp-Android | +| content-type | application/json | + +### Example URL and Response + +```json +{ + "data": { + "storeWishlist": [ + { + "__typename": "Product", + "boxArt": { + "__typename": "Media", + "url": "https://image.api.playstation.com/cdn/UP0102/CUSA07104_00/1SByc6guxYutHXu41xOlIjzh1suAqSMr.png" + }, + "id": "UP0102-CUSA07104_00-SLUS201840000001", + "localizedStoreDisplayClassification": "Full Game", + "name": "Resident Evil™ Code: Veronica X", + "platforms": [ + "PS4" + ], + "price": { + "__typename": "SkuPrice", + "basePrice": "$14.99", + "discountText": null, + "discountedPrice": "$14.99", + "isExclusive": false, + "isFree": false, + "isTiedToSubscription": false, + "serviceBranding": [ + "NONE" + ], + "skuId": "UP0102-CUSA07104_00-SLUS201840000001-U001", + "upsellServiceBranding": [ + "NONE" + ], + "upsellText": null + }, + "storeDisplayClassification": "FULL_GAME" + }, + { + "__typename": "Product", + "boxArt": { + "__typename": "Media", + "url": "https://image.api.playstation.com/vulcan/ap/rnd/202205/1307/Ue3ndByOUb2iHviPJqImWsYy.png" + }, + "id": "UP0102-CUSA33877_00-CLASSICREDC00001", + "localizedStoreDisplayClassification": "Full Game", + "name": "Resident Evil Director’s Cut", + "platforms": [ + "PS4", + "PS5" + ], + "price": { + "__typename": "SkuPrice", + "basePrice": "$9.99", + "discountText": "-100%", + "discountedPrice": "Included", + "isExclusive": true, + "isFree": true, + "isTiedToSubscription": true, + "serviceBranding": [ + "PS_PLUS" + ], + "skuId": "UP0102-CUSA33877_00-CLASSICREDC00001-U001", + "upsellServiceBranding": [ + "PS_PLUS" + ], + "upsellText": "Premium" + }, + "storeDisplayClassification": "FULL_GAME" + } + ] + } +} +``` + +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri 'https://m.np.playstation.com/api/graphql/v1/op?operationName=metGetStoreWishlist&variables={}&extensions={"persistedQuery":{"version":1,"sha256Hash":"571149e8aa4d76af7dd33b92e1d6f8f828ebc5fa8f0f6bf51a8324a0e6d71324"}}' -Headers @{"apollographql-client-name"="PlayStationApp-Android";"content-type"="application/json"} -Authentication Bearer -Token $token | ConvertTo-Json -Depth 5 +``` \ No newline at end of file diff --git a/docs/misc/UserGames.md b/docs/misc/UserGames.md new file mode 100644 index 0000000..ab2476b --- /dev/null +++ b/docs/misc/UserGames.md @@ -0,0 +1,176 @@ +## User Played Games (PS4 titles and newer) + + https://m.np.playstation.com/api/gamelist/v2/users/{accountId}/titles + +This endpoint retrieves a users played games list, which includes stats such as the number of times the game has been played, the first and most recent dates the game was played, and the total time played (accurate to 1 second). It also returns additional metadata about a game including URLs for media used on the PlayStation Store, as well as all the Title Ids currently associated with the game. + +Games released for PS4 (and newer) are included in the list. By default it is sorted by most recently played. + +The endpoint can query the authenticating account, or it can query another user account (providing that the privacy settings on the other account allow it). + +### Input Parameters + +| Parameter | Type | Example Value | Description | Required | +| --- | --- | --- | --- | --- | +| accountId | String | `me`
`12340..` | The id of the account to query
Use `me` to query the authenticating account | Yes +| categories | String | `ps4_game,ps5_native_game`
`pspc_game`
`unknown` | Comma separated list of platforms | No +| limit | Numeric
**Min** 1
**Max** 200
**Default** 10 | `10` | Limit the number of titles returned | No +| offset | Numeric
**Min** 0
**Max** `totalItemCount` - 1
**Default** 0 | `20` | Returns title data from this result onwards
See [Support for Pagination](/APIv2?id=support-for-pagination) | No | + + +### Output JSON Response + +| Attribute | Type | Example Value | Description | +| --- | --- |--- | --- | +| titles | [JSON object](#user-played-games-titles-json-objects) | | Individual object for each title returned +| totalItemCount | Numeric | `300` | The total number of trophy titles for this account +| nextOffset | Numeric | `20` | See [Support for Pagination](/APIv2?id=support-for-pagination) +| previousOffset | Numeric | `299` | See [Support for Pagination](/APIv2?id=support-for-pagination) + +##### titles JSON objects :id=user-played-games-titles-json-objects + +| Attribute | Type | Example Response | Description | +| --- | --- |--- | --- | +| titleId | String | `CUSA01433_00` | Id for the specific version of the game played by the user +| name | String | `Rocket League®` | Name of the game +| localizedName | String | `Rocket League®` | Name of the game +| imageUrl | String | `https://iamge...` | URL for the game icon +| localizedImageUrl | String | `https://image...` | URL for the game icon +| category | String | `ps4_game`
`ps5_native_game`
`pspc_game`
`unknown` | Type of game +| service | String | `none(purchased)`
`none_purchased`
`ps_plus` | Is the game owned outright, or via a service entitlement +| playCount | Numeric | `100` | Number of times the game has been played +| concept | JSON object | | The concept is an single identifier for the various versions of a game
This object contains various metadata including the `conceptId` and the various Title Ids for this game +| media | JSON object | | This object contains various URLs for screenshots and other media associated with the game +| firstPlayedDateTime | Date (UTC) | `2015-07-10T19:40:19Z` | Date the game was first played +| lastPlayedDateTime | Date (UTC) | `2024-08-03T19:28:27.12Z` | Date the game was most recently played +| playDuration | [ISO 8601 Duration](https://en.wikipedia.org/wiki/ISO_8601) | `PT228H56M33S` | Time played accurate to 1 second
This example reads 228 hours, 56 minutes and 33 seconds + +##### Working with Time Durations + +When querying the API with PowerShell you can use the following function to convert the ISO 8601 duration string into a TimeSpan object, which will be easier to manipulate. + +```powershell +[Xml.XmlConvert]::ToTimeSpan() +``` + +An example for `PT228H56M33S`: +```powershell +[Xml.XmlConvert]::ToTimeSpan("PT228H56M33S") +``` + +Output: +```powershell +Days : 9 +Hours : 12 +Minutes : 56 +Seconds : 33 +Milliseconds : 0 +Ticks : 8241930000000 +TotalDays : 9.53927083333333 +TotalHours : 228.9425 +TotalMinutes : 13736.55 +TotalSeconds : 824193 +TotalMilliseconds : 824193000 +``` + +#### Example URLs and Responses + +#### Example 1 - Games list for the authenticating account + + https://m.np.playstation.com/api/gamelist/v2/users/me/titles + +```json +{ + "titles": [ + { + "titleId": "PPSA07950_00", + "name": "Call of Duty®", + "localizedName": "Call of Duty®", + "imageUrl": "https://image.api.playstation.com/vulcan/ap/rnd/202406/1421/5811b9a8ab59c7703c3d4f0a60748c029208aed35f28d7f3.png", + "localizedImageUrl": "https://image.api.playstation.com/vulcan/ap/rnd/202406/1421/5811b9a8ab59c7703c3d4f0a60748c029208aed35f28d7f3.png", + "category": "ps5_native_game", + "service": "none(purchased)", + "playCount": 392, + "concept": { + "id": 10001130, + "titleIds": "CUSA34084_00 PPSA07950_00 PPSA01649_00 PPSA09262_00 CUSA23826_00 CUSA35564_00 CUSA43691_00 CUSA48767_00 CUSA34032_00 PPSA07953_00 CUSA23827_00 CUSA34087_00 CUSA34083_00 CUSA43690_00 CUSA34029_00 PPSA09265_00 CUSA48768_00 CUSA35561_00 CUSA43694_00 CUSA34031_00 CUSA34086_00 CUSA48765_00 PPSA09264_00 CUSA48769_00 CUSA35562_00 CUSA43693_00 PPSA07951_00 CUSA34030_00 CUSA34085_00 CUSA35563_00 CUSA48766_00 PPSA09263_00 CUSA43692_00 PPSA07952_00", + "name": "Call of Duty®", + "media": "@{audios=System.Object[]; videos=System.Object[]; images=System.Object[]}", + "genres": "ACTION", + "localizedName": "@{defaultLanguage=en-US; metadata=}", + "country": "GB", + "language": "en" + }, + "media": { + "audios": "", + "videos": "", + "images": " " + }, + "firstPlayedDateTime": "2022-10-20T20:26:17Z", + "lastPlayedDateTime": "2024-08-03T20:40:21.78Z", + "playDuration": "PT340H46M13S" + }, + { + "titleId": "CUSA01433_00", + "name": "Rocket League®", + "localizedName": "Rocket League®", + "imageUrl": "https://image.api.playstation.com/vulcan/ap/rnd/202406/1015/b3767253dc1f28bc5213300131216efe3eb351b98f7bc37a.png", + "localizedImageUrl": "https://image.api.playstation.com/vulcan/ap/rnd/202406/1015/b3767253dc1f28bc5213300131216efe3eb351b98f7bc37a.png", + "category": "ps4_game", + "service": "ps_plus", + "playCount": 685, + "concept": { + "id": 203715, + "titleIds": "CUSA02837_00 CUSA01759_00 CUSA05310_00 CUSA01163_00 CUSA01433_00 CUSA03686_00 CUSA10695_00 CUSA05270_00 CUSA13031_00 CUSA10690_00 CUSA01653_00 CUSA12808_00 CUSA12970_00", + "name": "Rocket League®", + "media": "@{audios=System.Object[]; videos=System.Object[]; images=System.Object[]}", + "genres": "SPORTS RACING ACTION", + "localizedName": "@{defaultLanguage=en-US; metadata=}", + "country": "GB", + "language": "en" + }, + "media": { + "audios": "", + "videos": "", + "images": " " + }, + "firstPlayedDateTime": "2015-07-10T19:40:19Z", + "lastPlayedDateTime": "2024-08-03T19:28:27.12Z", + "playDuration": "PT228H56M33S" + }, + <#-- truncated --#> + ], + "nextOffset": 10, + "previousOffset": 0, + "totalItemCount": 900 +} + +``` +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri "https://m.np.playstation.com/api/gamelist/v2/users/me/titles" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 3 +``` + +!> Note the Concept and Media attributes are truncated by this command. If you want to capture the full response then increase `ConvertTo-Json -Depth 3` to something like `10`, or omit this command and capture the response into a PowerShell object. + +#### Example 2 - Games list for another PSN account with accountId _0000000000000000000_ + + https://m.np.playstation.com/api/gamelist/v2/users/0000000000000000000/titles + +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri "https://m.np.playstation.com/api/gamelist/v2/users/0000000000000000000/titles" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 3 +``` + +!> Note the Concept and Media attributes are truncated by this command. If you want to capture the full response then increase `ConvertTo-Json -Depth 3` to something like `10`, or omit this command and capture the response into a PowerShell object. + +#### Example 3 - PS5 only games list for the authenticating account + + https://m.np.playstation.com/api/gamelist/v2/users/me/titles?categories=ps5_native_game + +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri "https://m.np.playstation.com/api/gamelist/v2/users/me/titles?categories=ps5_native_game" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 3 +``` + +!> Note the Concept and Media attributes are truncated by this command. If you want to capture the full response then increase `ConvertTo-Json -Depth 3` to something like `10`, or omit this command and capture the response into a PowerShell object. \ No newline at end of file diff --git a/docs/misc/UserProfile.md b/docs/misc/UserProfile.md new file mode 100644 index 0000000..6a03725 --- /dev/null +++ b/docs/misc/UserProfile.md @@ -0,0 +1,200 @@ +## Basic User Profile + + https://us-prof.np.community.playstation.net/userProfile/v1/users/{onlineId}/profile2 + +In addition to returning basic information about a PSN account, this endpoint also allows you to find an accounts `accountId` directly from the accounts username (`onlineId`). This is useful as many other endpoints which query another PSN account depend on querying against the `accountId`. + +The endpoint can query the authenticating account, or it can query another user account (providing that the privacy settings on the other account allow it). + +### Input Parameters + +| Parameter | Type | Example Value | Description | Required | +| --- | --- | --- | --- | --- | +| onlineId | String | `me`
`username` | The username of the account to query
Use `me` to query the authenticating account | Yes +| fields | String | `accountId,onlineId,currentOnlineId` | Comma separated list of account attributes to return
Some are encapsulated within `@attribute(attribute1, attribute2)` notion | No + +
+ Click to view additional `fields` parameter details + Examples of other fields will be added here. +
+ +### Output JSON Response + +A JSON response is returned. The following are returned under the `profile` attribute (dependant on which fields are supplied as the input parameter). + +| Attribute | Type | Example Value | Description | +| --- | --- |--- | --- | +| onlineId | String | `username` | The username of the account being accessed +| accountId | Numeric | `12340..` | The ID of the account being accessed +| currentOnlineId | String | `username` | If you query the original username of an account that has since changed its name, then this field is returned to tell you what the current username is + +### Example URLs and Responses + +#### Example 1 - Profile of the authenticating account + + https://us-prof.np.community.playstation.net/userProfile/v1/users/me/profile2?fields=accountId,onlineId,currentOnlineId + +```json +{ + "profile": { + "onlineId": "username", + "accountId": "0000000000000000000" + } +} +``` +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri "https://us-prof.np.community.playstation.net/userProfile/v1/users/me/profile2?fields=accountId,onlineId,currentOnlineId" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 3 +``` + +#### Example 2 - Profile of user account "example" which had subsequently changed username to "newexample" + + https://us-prof.np.community.playstation.net/userProfile/v1/users/example/profile2?fields=accountId,onlineId,currentOnlineId + +```json +{ + "profile": { + "onlineId": "example", + "accountId": "0000000000000000000", + "currentOnlineId": "newexample" + } +} +``` +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri "https://us-prof.np.community.playstation.net/userProfile/v1/users/example/profile2?fields=accountId,onlineId,currentOnlineId" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 3 +``` + +## Alternative User Profile + + https://m.np.playstation.com/api/userProfile/v1/internal/users/{accountId}/profiles + +An alternative profile endpoint to the above, it retrieves a more limited set of information for an account and it requires knowing the `{accountId}` rather than the `{onlineId}`. However, unlike the above example, this is an endpoint which is still actively used by the PS App and so may have greater longevity. + +The endpoint can query the authenticating account, or it can query another user account (providing that the privacy settings on the other account allow it). + +### Input Parameters + +| Parameter | Type | Example Value | Description | Required | +| --- | --- | --- | --- | --- | +| accountId | Numeric | `12340..` | The ID of the account to query | Yes + +### Output JSON Response + +| Attribute | Type | Example Value | Description | +| --- | --- |--- | --- | +| onlineId | String | `username` | The username of the account being accessed +| personalDetail | JSON Object | | Contains the users real name, and URLs to the custom profile picture if they have set one. Only returned for the authenticating account, or if queried account privacy settings allow it +| aboutMe | String | `Hello there` | A user defined description field (up to 140 characters)
An empty string if not set +| avatars | JSON Object | | URLs for the users avatar in various sizes (`s`, `m`, `l`, `xl`) +| languages | JSON Object | `en-us` | Up to three languages that the user has selected for their account +| isPlus | Boolean | `true` | `true` when user is a PS+ member +| isOfficiallyVerified | Boolean | `true` | `true` when user is a VIP +| isMe | Boolean | `true` | `true` if the queried user is the authenticating account + +### Example URLs and Responses + +#### Example 1 - Profile of the authenticating account with accountId _0000000000000000000_ + + https://m.np.playstation.com/api/userProfile/v1/internal/users/0000000000000000000/profiles + +```json +{ + "onlineId": "ExampleUser", + "personalDetail": { + "firstName": "Example", + "lastName": "User" + }, + "aboutMe": "", + "avatars": [ + { + "size": "s", + "url": "http://static-resource.np.community.playstation.net/avatar_s/WWS_J/IP90001008001s.png" + }, + { + "size": "xl", + "url": "http://static-resource.np.community.playstation.net/avatar_xl/WWS_J/IP90001008001_XL.png" + }, + { + "size": "l", + "url": "http://static-resource.np.community.playstation.net/avatar/WWS_J/IP90001008001l.png" + }, + { + "size": "m", + "url": "http://static-resource.np.community.playstation.net/avatar_m/WWS_J/IP90001008001m.png" + } + ], + "languages": [ + "en-US" + ], + "isPlus": false, + "isOfficiallyVerified": false, + "isMe": true +} +``` +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri "https://m.np.playstation.com/api/userProfile/v1/internal/users/0000000000000000000/profiles" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 3 +``` + +#### Example 2 - Profile of a verified VIP account account with accountId _0000000000000000000_ + + https://m.np.playstation.com/api/userProfile/v1/internal/users/0000000000000000000/profiles + +```json +{ + "onlineId": "yosp", + "personalDetail": { + "displayName": "Shuhei Yoshida", + "profilePictures": [ + { + "size": "s", + "url": "https://image.api.np.km.playstation.net/images/?format=png&w=50&h=50&image=https%3A%2F%2Fkfscdn.api.np.km.playstation.net%2Faf0e927a83a156e3ca65f2b7c1209768ce359d7b56882ccfa1d42b50bbffc0a9%2Fccf1c3ecd834e5af6da17fc7c67acc3d%2F1412032653104.png" + }, + { + "size": "m", + "url": "https://image.api.np.km.playstation.net/images/?format=png&w=160&h=160&image=https%3A%2F%2Fkfscdn.api.np.km.playstation.net%2Faf0e927a83a156e3ca65f2b7c1209768ce359d7b56882ccfa1d42b50bbffc0a9%2Fccf1c3ecd834e5af6da17fc7c67acc3d%2F1412032653104.png" + }, + { + "size": "l", + "url": "https://image.api.np.km.playstation.net/images/?format=png&w=240&h=240&image=https%3A%2F%2Fkfscdn.api.np.km.playstation.net%2Faf0e927a83a156e3ca65f2b7c1209768ce359d7b56882ccfa1d42b50bbffc0a9%2Fccf1c3ecd834e5af6da17fc7c67acc3d%2F1412032653104.png" + }, + { + "size": "xl", + "url": "https://image.api.np.km.playstation.net/images/?format=png&w=440&h=440&image=https%3A%2F%2Fkfscdn.api.np.km.playstation.net%2Faf0e927a83a156e3ca65f2b7c1209768ce359d7b56882ccfa1d42b50bbffc0a9%2Fccf1c3ecd834e5af6da17fc7c67acc3d%2F1412032653104.png" + } + ] + }, + "aboutMe": "Shuhei Yoshida", + "avatars": [ + { + "size": "s", + "url": "http://static-resource.np.community.playstation.net/avatar_s/SCEI/IP91001401PR2_10DB033BEC5A1E6A2351_S.png" + }, + { + "size": "xl", + "url": "http://static-resource.np.community.playstation.net/avatar_xl/SCEI/IP91001401PR2_50D89087FFA1BD35844B_XL.png" + }, + { + "size": "l", + "url": "http://static-resource.np.community.playstation.net/avatar/SCEI/IP91001401PR2_BFFC2B8AD0E21BC6CE29_L.png" + }, + { + "size": "m", + "url": "http://static-resource.np.community.playstation.net/avatar_m/SCEI/IP91001401PR2_99ED763F79B9E245F073_M.png" + } + ], + "languages": [ + "ja-JP", + "en-US" + ], + "isPlus": true, + "isOfficiallyVerified": true, + "isMe": false +} +``` +Executing this example using Powershell - see [Querying the API](/APIv2?id=powershell-7) +```powershell +Invoke-RestMethod -Uri "https://m.np.playstation.com/api/userProfile/v1/internal/users/0000000000000000000/profiles" -Authentication Bearer -Token $token | ConvertTo-Json -Depth 3 +``` + diff --git a/docs/misc/_navbar.md b/docs/misc/_navbar.md new file mode 100644 index 0000000..fcea271 --- /dev/null +++ b/docs/misc/_navbar.md @@ -0,0 +1,7 @@ + + +* [Misc API](/misc/) +* [Trophy API](/) +* Other APIs + * [PlayStation Stars](https://andshrew.github.io/PlayStation-Stars/) + * [PS5 Backwards Compatibility](https://andshrew.github.io/supreme-enigma) \ No newline at end of file