[ API Service ] v1.0.5 - A Utility ModuleScript for Roblox API Methods

[ API Service ]
A Utility ModuleScript for Roblox API Methods

In short, this is a utility module that includes easy methods for referencing class data via an API dump.

The current main methods include the following:

RobloxAPI: Returns table of Roblox’s API dump.

GetProperties(<Instance>, <boolean> writableOnly): Returns readable properties. ([Name]=Value)
(Returns writable-only properties if second argument is true. Default is false.)

GetProperties(<string> ClassName, <boolean> writableOnly): Returns readable properties. (Name only)
(Returns writable-only properties if second argument is true. Default is false.)

GetFunctions(<Instance>): Returns readable functions. ([Name]=Value)

GetEvents(<Instance>): Returns readable events. ([Name]=Value)

GetClassIcon(<Instance>/<string> ClassName): Returns Icon data for class. Result is the same as StudioService:GetClassIcon().

GetRawClassData(<string> ClassName): Returns class data for given ClassName from the API dump.

GetRawSuperclassMembers(<string> ClassName): Returns all superclass members for given ClassName from the API dump.

GetRawSuperclassProperties(<string> ClassName): Returns all superclass properties for given ClassName from the API dump.

JSONEncodeValue(<DataType/Property>): Encodes value for use in JSONEncoding.

JSONDecodeValue(<DataType/Property>): Decodes encoded value from JSON string format. Only compatible with interal “JSONEncodeValue”.

Serialize(<Instance>, <boolean> getDescendants, <boolean> ignoreScripts): Serializes an instance (and descendants if enabled) into a string format.
(If second argument is true, descendants of the instance will also be serialized. Default is true.)
(If third argument is true, script source code will be ignored. Default is false.)

Deserialize(<Instance>): Returns deserialized instance (and descendants if any). Only compatible with interal serialization.

PrintVersion(<void>): Prints all version information in “Output”.

DeveloperVersion: Version number of release.

DumpVersion: Version of API dump. (Not the version of Roblox API)

LuaVersion: Returns Lua version used at time of version release.

CreatorId: Returns the UserId of “API Service” (ModuleScript) developer.

PrintCredits(<void>): Prints credits in “Output”.

Test(<void>): Returns “true” if base and required ModuleScripts have been required correctly.
Constructors: Table of basic constructors. (Mainly used for internal operations.)

Attributes of APIService:
IgnoreUpdates: If true, update warnings will no longer appear in the output.

Example:

local API = require(7995685995) -- Or replace with path to module
local properties = API:GetProperties(workspace:WaitForChild('SpawnLocation'))
for name,value in pairs(properties) do
	print(name,value)
end

Output:

{
	["AllowTeamChangeOnTouch"] = false,
	["Anchored"] = true,
	["Archivable"] = true,
	["AssemblyAngularVelocity"] = 0, 0, 0,
	["AssemblyCenterOfMass"] = -5.96046448e-08, 0.25, -1.1920929e-07,
	["AssemblyLinearVelocity"] = 0, 0, 0,
	["AssemblyMass"] = inf,
	["AssemblyRootPart"] = SpawnLocation,
	["BackParamA"] = -0.5,
	["BackParamB"] = 0.5,
	["BackSurface"] = Smooth,
	["BackSurfaceInput"] = NoInput,
	["BottomParamA"] = -0.5,
	["BottomParamB"] = 0.5,
	["BottomSurface"] = Smooth,
	["BottomSurfaceInput"] = NoInput,
	["BrickColor"] = Medium stone grey,
	["CFrame"] = -5.96046448e-08, 0.25, -1.1920929e-07, 1, 0, 0, 0, 1, 0, 0, 0, 1,
	["CanCollide"] = true,
	["CanQuery"] = true,
	["CanTouch"] = true,
	["CastShadow"] = true,
	["CenterOfMass"] = 0, 0, 0,
	["ClassName"] = "SpawnLocation",
	["CollisionGroupId"] = 0,
	["Color"] = 0.639216, 0.635294, 0.647059,
	["Duration"] = 0,
	["Elasticity"] = 0.5,
	["Enabled"] = true,
	["FormFactor"] = Brick,
	["Friction"] = 0.300000011920929,
	["FrontParamA"] = -0.5,
	["FrontParamB"] = 0.5,
	["FrontSurface"] = Smooth,
	["FrontSurfaceInput"] = NoInput,
	["LeftParamA"] = -0.5,
	["LeftParamB"] = 0.5,
	["LeftSurface"] = Smooth,
	["LeftSurfaceInput"] = NoInput,
	["LocalTransparencyModifier"] = 0,
	["Locked"] = false,
	["Mass"] = 5.599999904632568,
	["Massless"] = false,
	["Material"] = Plastic,
	["Name"] = "SpawnLocation",
	["Neutral"] = true,
	["Orientation"] = 0, 0, 0,
	["Parent"] = Workspace,
	["PivotOffset"] = 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
	["Position"] = -5.96046448e-08, 0.25, -1.1920929e-07,
	["ReceiveAge"] = 0,
	["Reflectance"] = 0,
	["ResizeIncrement"] = 1,
	["ResizeableFaces"] = Right, Top, Back, Left, Bottom, Front,
	["RightParamA"] = -0.5,
	["RightParamB"] = 0.5,
	["RightSurface"] = Smooth,
	["RightSurfaceInput"] = NoInput,
	["RootPriority"] = 0,
	["RotVelocity"] = 0, 0, 0,
	["Rotation"] = 0, 0, 0,
	["Shape"] = Block,
	["Size"] = 4, 0.5, 4,
	["SpecificGravity"] = 0.699999988079071,
	["TeamColor"] = Medium stone grey,
	["TopParamA"] = -0.5,
	["TopParamB"] = 0.5,
	["TopSurface"] = Smooth,
	["TopSurfaceInput"] = NoInput,
	["Transparency"] = 0,
	["Velocity"] = 0, 0, 0,
	["archivable"] = true,
	["brickColor"] = Medium stone grey,
	["className"] = "SpawnLocation",
	["formFactor"] = Brick
}

(Technically it would print a bit differently, but this output example looks nicer).

When required, it will automatically make a check to see if it’s up-to-date. However it won’t auto-update.

API Service (272.2 KB) - Model page

This was my first attempt at something like this. Let me know if there are any other features you’d like to see included in this module.

Also credits to this tool for generating the API dump.


Other Resources:

18 Likes

I really needed this sooo much to make my block saving system, thank you

Also, it’s crazy that an simple objects has thousands of properties lol

2 Likes

Oh… this is just the developer.roblox.com API, not api.roblox.com API

1 Like

Is there an issue with that? Or does api.roblox.com already give a database of everything?

1 Like

No problem. I just assumed it was api.roblox.com, because you might want to use that in game and it also requires a proxy to access.

Roblox Instances is already used to make Roblox games.

This module seems to just display the API for Instances. I’m not sure why I would want it though because all the API is available on developer.roblox.com

1 Like

Ah, I see what you mean. I wish Roblox didn’t require a proxy to access the website, but I understand why they do that. Though I feel like it would be better if they just added a rate limit per server? But I guess I don’t know enough about that to really have an opinion on the matter.

To be fair, this is one of those things that is extremely useful for incredibly specific things. The primary uses I can see this being used for are custom explorers and scripting plugins (such as a visual scripting system). Both of which are things that I’m interested in pursuing at some point.

A custom explorer would be useful for developers (or at least me) to have an in-game explorer for live servers that lets me view and edit things both client and server-side (depending on which I have selected).

Then visual scripting is kind of self explanatory. A system somewhat like the blueprint system in Unreal Engine or the newer system they have in Unity. I have yet to plan out exactly how I would design the nodes as it needs to be both easy to use while still allowing you to do everything you want. It needs to do that without being more tedious than simply writing the code by hand. Although the target audience would likely me people who don’t code by hand.

1 Like

Sometimes people create complex systems and algorithms that require Instances to have certain properties (such as object serialization). This module makes it easy for people to determine whether or not something has a specific property.

There’s a feature request thread filled with more use-cases.


The current work-around is something like this:

local function InstanceHasProperty(instance : Instance, property : string) : boolean
   return pcall(function()
      return instance[property]
   end)
end
1 Like

v1.0.2
Nothing new, but I’ve updated the instance API as I haven’t updated it since last year.

Let me know if there’s any feature you’d like to see added or changed.

v1.0.3

  • Updated API dump
  • Added “GetRawSuperclassProperties
  • Added “JSONEncodeValue
  • Added “JSONDecodeValue
  • Added “Serialize
  • Added “Deserialize
  • Added “Constructors
  • Added “IgnoreUpdates
  • Added “GetClassIcon
  • Other minor changes.

Just a note with the serialization. I’m not sure why, but it appears to be a bit intensive. It can only really handle up to about 50 instances before it times-out (even with delays). But it does support probably 99% of instance types and properties.
One other note is that any property involving another instance can’t be guaranteed when serializing unless it’s among one of the instances being serialized.
(Also serialization doesn’t work with unions at all probably, or terrain for that matter.)

Forgot to add “GetClassIcon” to the logs

v1.0.4

  • Updated API dump (Just in case)
  • Fixed “GetClassIcon"

v1.0.5

  • Updated API dump (Bi-Annual)
  • No other changes