Trying to use the Presence API, but I'm getting HTTP 404(Not found)

So the issue is I’m trying to hook a proxy I made from this tutorial to changes I made with roproxy after seeing people say roproxy can be untrustworthy.

In Presence, I don’t really see any parameters in the link but it seems it receives data through a body of UserIds:

Presence

local function CheckIfOnline(UserId : number)
	local URL = MainUrl .. "v1/presence/users" --My current attempt to match my main url with presence

	local Body = '{"userIds": [' .. UserId ..  ']}'



	local Response = HttpService:PostAsync(URL, Body) -- When actually using code, wrap this in pcall()
	local DecodedResponse = HttpService:JSONDecode(Response)

	local PresenceType = DecodedResponse["userPresences"][1]["userPresenceType"]

	if tonumber(PresenceType) == 0 then -- User is offline
		return false
	else -- User is online
		return true
	end
end

I also tried making the URL the full curl url(with roblox.com) but it created the same result in the output(HTTP 404 (Not Found)).

Example of how the proxy works(doesn’t actually work):

local Http = game:GetService('HttpService')


local Encode = Http:UrlEncode("https://api.roblox.com/users/471263686/onlinestatus/") 
local Link = "https://effex-proxy.glitch.me/?link="..Encode

print(Link)

print(Http:JSONDecode(Http:GetAsync(Link)))

remove that and it should work

1 Like

Are you referring to the first piece of code? There aren’t any https:// and in the first one there is because I was just providing an example.

Updated(Not fixed):

local function CheckIfOnline(UserId : number)
	local URL = MainUrl .."presence.roblox.com/v1/presence/users"

	local Body = '{"userIds": [' .. UserId ..  ']}'
	
	
	local success,Response = pcall(HttpService.PostAsync,HttpService,URL, Body) -- When actually using code, wrap this in pcall()
	print(success,Response)
	if success then
		local DecodedResponse = HttpService:JSONDecode(Response)

		local PresenceType = DecodedResponse["userPresences"][1]["userPresenceType"]

		if tonumber(PresenceType) == 0 then -- User is offline
			return false
		else -- User is online
			return true
		end
	end
end

Unless you modified the glitch code (which I don’t think you have). It will not be able to handle post requests as their is currently no endpoint for it

Ah I see, do you know how/why it worked in this scenario where I tried to get user data:

local function GetUserData(userInfo)
	local url = MainUrl .. HttpService:UrlEncode("users.roblox.com/v1/users/"..userInfo.Id)
	local response = HttpService:GetAsync(url)
	local data = HttpService:JSONDecode(response)
	print(data)
	return data
end

You used a get request instead of a post request and didn’t include https://

1 Like

I’ll probably try to find out JS and update the proxy but I don’t really know any other shortcuts.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.