Place publishing within a game help

i have been trying to make place publishing in game like studio lite.

but http service just gives the error “The Http request failed to send: HttpService is not allowed to access that Roblox resource”

i have spent multiple days looking into publishing from within Roblox and can’t find any information on it.

Here is my current script i just really need to know, is the way I’m doing it possible, if not how should I do it?

local HttpService = game:GetService("HttpService")

local placeID = 17394518352
local universeID = 5952954771
local APIKey = "i censored the api key for this post but it is correct"

local function request()
	local response = HttpService:RequestAsync({
		Url = `https://apis.roblox.com/v1/`..universeID..`/places/`..placeID..`/versions`, -- Updates a user's group membership
		Method = "POST",
		Headers = {
			["Content-Type"] = "application/octet-stream", -- When sending JSON, set this!
			["x-api-key"] = APIKey, -- Set in Creator Hub
		},
		Body = HttpService:JSONEncode({versionNumber = 7}),
	})

	if response.Success then
		print("The response was successful:", response.StatusCode, response.StatusMessage)
	else
		print("The response returned an error:", response.StatusCode, response.StatusMessage)
	end
	print("Response body:\n", response.Body)
	print("Response headers:\n", HttpService:JSONEncode(response.Headers))
end

-- Remember to wrap the function in a 'pcall' to prevent the script from breaking if the request fails
local success, message = pcall(request)
if not success then
	print("The Http request failed to send:", message)
end

script.Parent.MouseButton1Down:Connect(request)

also if there are better ways that i should format this post please let me know (i should probably also add i am extremely new to open cloud API so I have probably made a lot of mistakes here)

1 Like

Hey there, this is because we don’t yet allow all API key routes to be called via HttpService.

Refer to: [Beta] Use Open Cloud via HttpService Without Proxies

The feature is still in beta so the amount of allowed Roblox endpoints you can hit from Studio / in-experience is limited. We will expand it in the future.

Please also note that you must use Secret Store to store the API key you send along to HttpService, it will not work if you pass it like a string like this.

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