Getting details from API

Hello!

I am trying to make a code that gets a player’s profile details (join date, current status and last online time and dat) from Users API. I was using Http service since I couldn’t find any other service for it.
I tried with :GetAsync() and :RequestAsync() but both caught error.

I would appreciate every little help!
Thanks!

1 Like

Use player.AccountAge

Save the os.date() in a datastore when the player leaves.

Send an Http request to the following link:
https://users.rprxy.xyz/v1/users/{id}/status

Here are some valuable recourses that will help you accomplish that:

https://users.roblox.com/docs
Full list of links you can send a request to. ^

Let me know if you need further help!
Kind regards,
Kostiskat

Thank you!
I’m not sure how to get a specific detail form the responsebody…
And the last online time, I mean online in roblox, for example, in the browser.

To my knowledge, I don’t know if there is any way to do that, but only last online in-game. This link:
https://users.rprxy.xyz/v1/users/{id} returns all the info for the player, not including last online on the website.

The responsebody will have to be decoded into a Lua table for it to work by using Json:Decode()

I hope this addresses all the enquiries you might have. Good luck!

1 Like

Here is a function to get the table he was talking about:

function getPlayerData(UserId)
	local http = game:GetService("HttpService")

	local url = "https://users.rprxy.xyz/v1/users/"..tostring(UserId)
	
	local result
	
	local success, fail = pcall(function()
		result = http:GetAsync(url)
	end)
	if result and success then
		return http:JSONDecode(result)
	else
		warn(fail)
	end
end