Here is a module that lets you trigger Roblox endpoints from in-game. Use https://api.roblox.com/docs?useConsolidatedPage=true to find all the endpoints, though most of them are not already setup in the module.
RobloxAPI.rbxmx (9.6 KB)
To use it
local RobloxAPI = require(game.ServerStorage.RobloxAPI)()
--This "logs you in" and authorizes the requests
RobloxAPI.SetRobloSecurity("PasteRobloSecurityHere")
--How to call an endpoint
RobloxAPI.Friends.FollowUser({UserID = 1}) --Will make whatever account is associated with the RobloSecurity follow the Roblox account
RobloxAPI.Friends.UnfollowUser({UserID = 1}) --Unfollows the Roblox account
Proxy
This module uses rprxy.xyz
as a proxy, Roblox doesn’t allow sending any HTTP request to roblox.com from in-game. If you want to use your own proxy, change the domain on line 4 in the RobloxAPI
module
How to get RobloSecurity
- Open Google Chrome
- Go to any page on roblox.com
- Press Ctrl + Shift + i to open Inspect Element
- Select application
- Copy the .ROBLOSECURITY code, without the warning message at the beginning. In the below pic, you’d copy everything after “0ECB1”…
- On the second line in the above example, where it says
RobloxAPI.SetRobloSecurity("PasteRobloSecurityHere")
, go and paste the code there
How to add an endpoint
Create a new ModuleScript, and use the code below as a reference
local Endpoint = {
Method = "GET",
Subdomain = "subdomain",
Path = "v1/{Option1}",
Body = {
Key = "{Option2}",
},
Options = {
["Option1"] = {Type = "string", Required = true},
["Option2"] = {Type = "string, number"},
},
}
return Endpoint
Endpoint.Method
= The HTTP method to use, HTTP methods
Endpoint.Subdomain
= The subdomain to use. Eg api
, groups
, catalog
Endpoint.Path
= The path to use. Most subdomains and paths are on https://api.roblox.com/docs?useConsolidatedPage=true
Endpoint.Body
= A table that gets converted to json and sent with the http request body.
Endpoint.Options
= The input the developer gives to the API. Mostly for basic validation of the request before it gets sent, but is also a useful reference for when you are using the API
Formatting
Anything in the endpoint path or body can be replaced with values from the request options. Example:
--Endpoint for joining a group
local Endpoint = {
Path = "v1/groups/{GroupID}/join-requests/users/{UserID}",
Body = {
key = "{GroupID}"
}
...
}
--Some other script
RobloxAPI.Groups.JoinGroup({GroupID = 1, UserID = 2})
In that example, {GroupID}
in the path will be replaced with 1
and {UserID}
with 2
also
Not a lot of endpoints are supported currently, but if anyone wants to set some up I can add them to the downloadable file above.