Help using :PostAsync

How can I get this to work (below) also how do you setup the headers? I have tried to look at the roblox dev page on it but it does not really help.

HttpService:PostAsync({
		url: 'api.rankblox.tk/test',
        headers: 
	})

firstly, add https:// before your URLs or requests will not work

second, :PostAsync() takes a tuple as input, not a table.

citation: HttpService:PostAsync

local HttpService = game:GetService("HttpService")
HttpService:PostAsync("https://api.rankblox.tk/test", HttpService:JSONEncode({
	-- data here
}), Enum.HttpContentType.ApplicationJson, false, { -- change content type if u want
	-- headers here
})

wrap in a pcall, also i sure hope you are confident in your authentication flow if you’re willing to expose your urls publicly

1 Like