User API not working for me

This is my first time using APIs and I’m very confused. I’m trying to get a user’s online status and print it in the output. Here is my code:

local httpService = game:GetService("HttpService")
local data = httpService:GetAsync("http://https://api.roblox.com/users/38152945/onlinestatus/")
data = httpService:JSONDecode(data)
print(data)

I’m most likely doing something wrong. All help appreciated!

Do you have HTTPS requests turned on?

1 Like

Yes. Did it in game settings. Definitely turned on.

Gives me this error:
HttpError: InvalidUrl

You are missing the proxy and it was misspelled:

local data = httpService:GetAsync("https://api.rprxy.xyz/users/38152945/onlinestatus/")

I didn’t even realize it xd thanks @adamaniac

1 Like
local data = httpService:GetAsync("http://https://api.roblox.com/users/38152945/onlinestatus/")

Should be:

local data = httpService:GetAsync("https://api.roblox.com/users/38152945/onlinestatus/")
1 Like

That gives me an error of InvalidUrl

That gives me an error of trust check failed

Check again, @adamaniac has part of the solution.

JSONDecode returns a table you cant print tables

You can’t send requests directly to Roblox from a game, you will need to use a proxy to make the request for you.

this works, just have to look at this Tables | Roblox Creator Documentation

Amm, I know, I just corrected what I provide @Towren, maybe he know it too and cut that part.
In addition, the tables can be printed:
image