How can I get data from pastebin using httpservice getasync?

Need some help in the right direction

I have made my contents of the pastebin into a json format but nothing prints out

local success, response = pcall(function()
    local data = httpService:GetAsync("https://pastebin.com/RL7RcM2C")
    local codesArray = httpService:JSONDecode(data)
    print(codesArray)
end)

There’s actually a pretty simple way to do this:

local pastebinId = ""; -- The paste bin's id, in this case: RL7RcM2C
local success, respone = pcall(function()
    local url = string.format("https://pastebin.com/raw%s", "/" .. pastebinId);
    local data = httpService:GetAsync(url);
    local codesArray = httpService:JSONDecode(data);

    print(codesArray);
end);
7 Likes

Really? In my case:

print(game:GetService("HttpService"):GetAsync("https://pastebin.com/raw/xxxxxx"))

works fine.

3 Likes

What is the %s? is it a placeholder for the second parameter?

It is!

print(string.format("Hey there, %s!", "n_cy")) --> Hey there, n_cy!