Is there any way for me to get information on which an asset is a gamepass or a different asset ID, just from its asset ID? MarketplaceService:GetProductInfo()
does not work because you have to specify the product type.
I looked on the developer hub page for this function, and in the āParametersā section they do ask for a infoType Enum. However, in the example they show below, no such data is included.
This is the example on the developer hub page:
local Asset = game:GetService("MarketplaceService"):GetProductInfo(125378389)
print(Asset.Name .. " :: " .. Asset.Description)
Iāve also seen others use this function without the infoType included.
Have you already tried leaving it out completely, and seeing if it works without?
Providing no info type works, but the asset returned isnāt a gamepass, so for example requesting the pass ā12345678ā would return a place instead of a game pass object.
If you want to return just gamepasses, then you could provide also the InfoType āEnum.InfoType.GamePassā.
local Asset = game:GetService("MarketplaceService"):GetProductInfo(125378389, Enum.InfoType.GamePass)
If you need to dynamically get the ProductType from a AssetID - you will need to call a Roblox API web endpoint - which would require a external server.
The specific endpoint you will need to use is:
http://api.roblox.com/Marketplace/ProductInfo?assetId=
The specific thing to pay attention to is the AssetTypeId
in the response - that will vary between specific asset types.
In Roblox alone there is no API unfortunately that can allow you to see this normally as far as I am aware.
Though you technically canāt seem to be able to do this directly as @Monofur said, you can use a proxy server to make the request, and return the result back to your roblox script.
Here is a great way to make a free proxy using Google Apps Script:
Using Google Apps As A api.roblox.com And www.roblox.com Proxy
What I wonder though, is why roblox would require input for assetType for their Lua function, especially when it doesnāt seem to be needed, but not for their public API.
But since we are working with AssetIds, there is only one asset per ID, right? If 12345678 is a place, then you couldnāt get a gamepass from it.
You can find out what the asset type is, but you shouldnāt be able to declare it since there is only one asset per AssetId.
I thought Iād need to do this, I just didnāt know which endpoint to use. Thanks