andshrew / 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.
MIT License
100 stars 4 forks source link

Account Creation Date Endpoint / Query #22

Open Dev-R opened 10 months ago

Dev-R commented 10 months ago

Hello, @andshrew!

I've been exploring your projects and code, and I must say you've done an excellent job, especially with the documentation – it's really well done!

I've been on the hunt for a way to find the creation date of a PSN (PlayStation Network) Account. I've noticed that some people have already implemented this in Discord and Telegram bots, but they are reluctant to share their methods.

As an example, here's a sample of the output I've come across:

img

All the data displayed here is accessible to our open-source community except for the creation date. I'd love to hear your thoughts on this. Do you have any insights on how I can obtain this piece of information?

andshrew commented 10 months ago

Hi @Dev-R , thanks for your comments.

It isn't something I've really looked for, so I don't immediately know. Are you looking to find your own accounts creation date, or are you trying to look up the creation date of other accounts?

If you're in a region where PS Direct exists then I do know you can see your own creation date via that site. The following returns customerSince:

https://api.direct.playstation.com/commercewebservices/ps-direct-gb/my-account/profile?fields=FULL

Dev-R commented 10 months ago

Hello Again @andshrew,

Well, the bots can obtain any account creation date. So it seems like it can be obtained based on the account ID. And that is what I'm looking for ;).

andshrew commented 10 months ago

I see. Well should I come across anything I'll share it here.

Dev-R commented 10 months ago

Thank you! Another question do you know the operation name used to remove an item from a Playstation Store Cart? I know the one for adding is something like this: payload ={ "operationName": "addToCart", "variables": { "skus": [ { "skuId": "EP4807-CUSA11475_00-AV00000000000001-E001" } ] }, "extensions": { "persistedQuery": { "version": 1, "sha256Hash": "93eb198753e06cba3a30ed3a6cd3abc1f1214c11031ffc5b0a5ca6d08c77061f" } } }

andshrew commented 10 months ago

@Dev-R you can find things like that by using your browsers dev tools (usually F12) and watching the requests which are made on the network tab when you use the PS store site.

So removing an item from your basket is a POST request to https://web.np.playstation.com/api/graphql/v1//op with a body/payload like:

{"operationName":"removeFromCart","variables":{"skuId":"EP9000-PPSA08338_00-MARVELSPIDERMAN2-E004"},"extensions":{"persistedQuery":{"version":1,"sha256Hash":"d96cc4ac92c020c73a7d0cf00fdf7cd4b74fabef04605b417e6227d1785989dc"}}}
Delta0S commented 4 months ago

Hey @andshrew, I'm reaching out a bit late, but I'm curious if you've come across any API endpoints related to creation dates? I've scoured the internet, but it seems like you and a few others are the only ones discussing this. I recently stumbled upon a PSN checker on Telegram that utilizes these endpoints effectively (I Think). Although I lack coding skills and understanding of APIs, I'm eager to help my friend who's working on integrating creation date feature into his Discord bot. He's already developed functionalities for trophies and gameplay but lacks information on creation dates. Could you help us out? It would really make a difference for my Discord server focused on PlayStation tools. And I think a lot of PSN users would love it if they knew about this feature.

Edit: Also I don't know if this will help you but it looks something like this:

"creationDate": “2023-11-15 03:04:44”

andshrew commented 4 months ago

Hi @Delta0S

No, there's no change from the above. Can you provide the full output from your example?

andshrew commented 1 month ago

Here's another route for finding your own accounts creation date, along with some other details.

Log in to https://library.playstation.com/recently-purchased view the page source and search for customerSince.

Or to extract it using Javascript; paste this into your browsers developer console after that page has loaded:

var data = JSON.parse(document.getElementById('__NEXT_DATA__').innerText)
data.props.appProps.session.userData.customerSince

Output will be like:

2006-11-10T14:11:00.804+0000