So do i just do HttpProxy directly? without doing “HttpService:(Whatever)”?
Try using this link, it’s better specified.
https://avatar.roblox.com/v1/users/1/outfits?itemsPerPage=50
Yep you just ignore http service, the calls you need are already in the http proxy thing.
Thanks!!
but a slight issue… >_<
local outfitList = HttpService:JSONDecode(result)
it gets the outfit list using httpservice. Do i replace it with HttpProxy?
Replace the name “result” with outfitList. And remove that line. The http proxy module will auto handle JSONDecoding.
AHHHHHH im so confused it still gives me
Script:
local success, outfitList = pcall(function() return HttpProxy:GetAsync("https://avatar.roblox.com/v1/users/"..tostring(UserId).."/outfits?itemsPerPage=50") or nil, true end)
Do you have everything set up right with the proxy, review these steps:
And is the code on the Google app thing called “Code.gs”?
Do you have the little token set up correctly?
Sometimes it just starts working randomly for me.
Pretty sure i did.
Instead of Anyone, including anonymous i selected “Anyone” because there was no “Anyone, including anonymous”
Yes they changed it, that’s the right option. Just re view everything.
IT SHOULD BE in SERVERSCRIPTSERVICE. Don’t put it in ReplicatedStorage because the key you put in is private, and any client can view that module if it’s on ReplicatedStorage. It’s also not even possible for a client to use those functions in game directly.
Make sure the project on the Google app thing is saved and everything.
I tried to do this for getting a live group member count. However it keeps returning nil.
Here’s the code:
local HttpProxy = require(game.Workspace.HttpProxyService:Clone())
GroupId = 5458485
Members = game.HttpService:JSONEncode(HttpProxy:GetAsync("https://groups.roblox.com/v1/groups/" .. tostring(GroupId))).memberCount
print(Members)
game.ReplicatedStorage.RemoteEvent:FireAllClients(Members)
while wait(10) do
local success, err = pcall(function()
GroupId = 5458485
Members = game.HttpService:JSONEncode(HttpProxy:GetAsync("https://groups.roblox.com/v1/groups/" .. tostring(GroupId))).memberCount
print(Members)
game.ReplicatedStorage.RemoteEvent:FireAllClients(Members)
end)
if not success then
warn("[ERROR] " .. err)
end
end
EDIT: I figured out the issue, I wasn’t decoding the data that was being retrieved.
I know this post is old but incase I can get some help;
This returns a string and not the JSON Table, anyway to fix this? Not the biggest JavaScript guy
Assuming the string you are getting back is some JSON response string there is one thing you can do which is utilize HttpService
so what you’ll do is use the JSONDecode
function and pass that string response you get, and it will return a table in return.
Example:
local jsonStr = "some json string here"
local data = game.HttpService:JSONDecode(jsonStr) --> should return a table {}
Here’s the documentation on this.
https://developer.roblox.com/en-us/api-reference/function/HttpService/JSONDecode
Awesome thank you, will do
30charcharcharchar
Ok it doesn’t seem like you quite understood, the proxy AKA the googlescript returns strings, meaning it will literally convert tables into strings, which will ruin most of the stuff I’m working on. I was asking if there is any way to send the tables back to my game in a JSON Table due to me not being able to scan the variables in said table I am trying to request without the use of string patterns and stuff
What does your response from the website look like?
The API returns a JSON table as usual, but using the given proxy it will convert that table to a string, so it literally returns a string that I have to sepperate (Which I’ll just tell you right now, works terribly because you can’t design a JSON table in a language that doesn’t support it (From my knowledge))