Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Get Limited Item's best price? Help requesting API

Asked by 3 years ago
Edited 3 years ago

Hello! I have made a game that gets a limited item's best price in the past, but that sent a request to a bot which then returns the best price. However the bot goes down here and there, and it is not the best. I have seen that it is possible using https service. I have made a total RAP count and even the player's limited list, but cannot figure out how to get the best price of an item. I have checked out this, but do not know how to request what I am looking for: https://developer.roblox.com/en-us/articles/Catalog-API

At the bottom it mentions "BestPrice" is for limited items and it returns the best price. I am unsure how to get this though, if it helps here are my other scripts. (Total RAP and limited list)

RAP

local httpService = game:GetService("HttpService")

local function GetTotalRAP(userId)
    local success, msg = pcall(function()
        local total = 0

        local function CollectRAP(cursor)
            local url = "https://inventory.rprxy.xyz/v1/users/" .. userId .. "/assets/collectibles?sortOrder=Asc&limit=100"

            if cursor then
                url = url .. "&cursor=" .. cursor
            end

            local data = httpService:GetAsync(url)
            data = httpService:JSONDecode(data)

            for i = 1, #data["data"] do
                pcall(function()
                    total = total + data["data"][i]["recentAveragePrice"]
                end)
            end

            if data["nextPageCursor"] then
                CollectRAP(data["nextPageCursor"])
            end
        end

        CollectRAP()

        return total
    end)

    if not success then
        warn(msg)
    else
        return msg
    end
end

Limited list (Clones UI and puts in player)

local httpService = game:GetService("HttpService")

function GetItems(plr)
    local success, msg = pcall(function()
        local userId = plr.UserId
        local has = false

        local function CollectRAP(cursor)
            local url = "https://inventory.rprxy.xyz/v1/users/" .. userId .. "/assets/collectibles?sortOrder=Asc&limit=100"

            if cursor then
                url = url .. "&cursor=" .. cursor
            end

            local data = httpService:GetAsync(url)
            data = httpService:JSONDecode(data)

            for i = 1, #data["data"] do
                pcall(function()
                    --total = total + data["data"][i]["name"]
                    local clone = plr.PlayerGui.List.ScrollingFrame.TextLabel:Clone()
                    clone.Parent = plr.PlayerGui.List.ScrollingFrame
                    clone.Text = data["data"][i]["name"].." | "..data["data"][i]["recentAveragePrice"]
                    clone.Name = "Limited"
                    has = true
                end)
            end

            plr.PlayerGui.List.ScrollingFrame.User.Text = plr.Name.."'s Limiteds"

            if has == true then
                plr.PlayerGui.List.ScrollingFrame.TextLabel:Destroy()
            end

            if data["nextPageCursor"] then
                CollectRAP(data["nextPageCursor"])
            end
        end

        CollectRAP()
    end)

    if not success then
        warn(msg)
    else
        return msg
    end
end

I am stumped with this issue, if anybody can help me get the "BestPrice" value that would be great! Thank you, feel free to ask any questions or suggest anything at all!

Related posts that didn't seem to help me understand: https://devforum.roblox.com/t/how-to-get-price-of-limited/408749

https://devforum.roblox.com/t/best-way-to-get-the-limiteds-price/318018

https://devforum.roblox.com/t/how-to-get-the-best-price-of-a-limited-item/933494

https://scriptinghelpers.org/questions/84226/is-there-an-api-endpoint-for-lowest-price-on-limiteds

https://scriptinghelpers.org/questions/59732/how-could-i-get-data-from-limiteds

Please note that the scripts above is just other catalog API, not anything that is erroring, I just need help getting the API.

Answer this question