I want to be able to send a request to a API, and be able to get a reponse from it.
(Friends Api)
Example
local HttpService = game:GetService("HttpService")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local url = "https://friends.roblox.com/v1/users/"..player.UserId.."/friends"
local data = HttpService:GetAsync(url)
print(data)
end)
What is this code trying to achieve?
I want the code written above, to be able to:
1.) Get the friends a player has
2.) check each of the friends JoinDates
3.) Print out each of the friends AccountAge
So whats the problem?
The problem is, I don’t know how to do this. It seems simple enough but apparently after doing a bit of research, roblox blocks API requests from it’s own game… So yeah I have heard about making proxys and all that, but I am not going to make a whole proxy just to access a roblox API…
Have I done research?
I have been looking into this for around 3 days now, and the only solution I see is “make a proxy”, which I am not willing to do, so if their is another solution please let me know.
It does not give the age, it gives the id, username, display name, and a boolean if the player is online, you can use the GetFriendsOnline() which gives more info.
Yourself mention “For active players”, that is why i did not tell to use the AccountAge property as almost certainly not all friends will be online at the same time so for some the account age could not be obtained.
Since OP wants to get all user’s friends (and he needs an API request for it) it seems faster to me to calculate the AccountAge from the returned creation date as he will need a function to do so for friends that are not in the game