local r = http.get("https://api.github.com/orgs/Roblox/repos")
print(r.status_code, r.message)
-- 200 OK
local repos = r:json()
print(#repos)
-- 30
print(r.content_type)
-- application/json
print(r.encoding)
-- utf-8
print(r.headers["x-ratelimit-remaining"])
-- 59
local HttpService = game:GetService("HttpService")
local url_query = {arg1="val1", arg2="val2"}
local options = {
Url = ("https://httpbin.org/post?%s=%s&%s=%s")
:format("arg1", url_query.arg1, "arg2", url_query.arg2),
Method = "POST",
Headers = {["Content-Type"] = "application/json"},
Body = HttpService:JSONEncode(
{a=1, b=2, this="is json"}
)
}
local r = HttpService:RequestAsync(options)
print(r.Headers["content-type"])
local data = HttpService:JSONDecode(r.Body)
local http = require(ReplicatedStorage.http)
local r = http.post("https://httpbin.org/post",
{ query = {arg1="val1", arg2="val2"},
data = {a=1, b=2, this="is json"} })
print(r.headers["content-type"])
local data = r:json()
Nearly every modern digital experience makes use of internet resources.
Roblox Requests brings user-friendly HTTP to Roblox with no need for the manual labor of HttpService. You can send robust, human-readable requests, no need to manually add query-strings to your URLs, or form/json encode POST data.
An important part of writing good code is readability, especially when you're on a team.
With Roblox Requests, you'll never find yourself struggling to understand old code. Requests' powerful API is simple and to-the-point.
Roblox Requests allows you to create sessions that will retain information, similar to how your browser behaves.
Sessions feature cookie persistence with elegant key-value cookies, default headers, and URL prefixes.
Requests is designed so that you can make use of any web resource in Roblox without limitation.
You can send any type of content you need with Requests. JSON bodies are automatically encoded for you, and you can create multipart-encoded forms with ease. Requests will even encode binary files for you.
Requests also features automatic decoding of JSON, XML, and HTML response bodies.
To install and get started with Roblox Requests, head to the Documentation.