Quick actions

cmd+k|ctrl+k

Navigation

Languages

how to use veterra api

Snippet info

Language

Lua

Visibility

public

Author

thosewhoknow

Created

2021-09-23T17:58:53.868377Z

Updated

2021-09-23T17:58:53.868377Z

local http = game:GetService("HttpService")

--[[
	config is styled like this, eg.
	{
		color = "Green",
		rotation = "Circle",
		style = "Tablet"
	}
]]
function setConfig(config)
	local res = http:RequestAsync({
		Url = "https://veterra.lnriscute.repl.co/setConfig/"..tostring(owner.UserId),
		Method = "POST",
		Headers = {
			["cust"] = http:JSONEncode(config),
			["Content-Type"] = "application/json"
		},
		Body = {}
	})
	local dec = http:JSONDecode(res)
	if dec["status"] == "set" then
		-- it was successful
	elseif dec["status"] == "failed" then
		-- it failed
	end
end
function getConfig()
	local res = http:GetAsync("https://veterra.lnriscute.repl.co/getConfig/"..tostring(owner.UserId))
	return http:JSONDecode(res)
	-- returns a decoded table like as shown at line 3
end
INFO