API:Class/HttpService

Server only:This object is server-side only! You should use a Script instead of a LocalScript when using it.
Filtered-inheritance mode: While this class technically inherits all Instance class members, some (if not all) have been hidden because they serve no purpose for this object.
Service: This class is a service. It is a top-level singleton which can be obtained with the GetService method.
Uncreatable: This object cannot be created with Instance.new.

HttpService.pngHttpService : Object Icon.pngInstance

Note:This service is not allowed to send requests to any of the ROBLOX websites such as www.roblox.com or api.roblox.com.


This service allows HTTP requests to be sent from game servers. This enables users to create integration with a wide range of third party services such as analytics and storage. One exciting prospect for this service is that if you run and manage your own website, and communicate with it from ROBLOX, it opens the possibility of remote server management and real time communication with the server, through your site.

If the limit of 500 requests per minute is exceeded, the Service will stall entirely for approximately 30 seconds.

Usage ideas

  • Cross server marketplace
  • Real time stock market
  • Cross server leaderboard

Restrictions

  • Limit of 500 requests a minute (Per server)
  • Cannot send HTTP requests to the ROBLOX website

See also

Properties

PropertiesmemberhiddenProperties [toggle]

boolHttpEnabled [LocalUserSecurity]

When set to true, you are able to send requests to other websites using GetAsync and PostAsync.

|RMD member="API:Class/HttpService/HttpEnabled"|When set to true, you are able to send requests to other websites using GetAsync and PostAsync.|/RMD|
HttpEnabled [LocalUserSecurity]
When set to true, you are able to send requests to other websites using GetAsync and PostAsync.

Functions

Functions [toggle]

stringGenerateGUID ( bool wrapInCurlyBraces = true )

Generates a globally unique identifier.

|RMD member="API:Class/HttpService/GenerateGUID"|Generates a globally unique identifier.|/RMD|
VariantJSONDecode ( string input )

Decodes a JSON string into a Lua table. Does not require HttpEnabled to be true.

|RMD member="API:Class/HttpService/JSONDecode"|Decodes a JSON string into a Lua table. Does not require HttpEnabled to be true.|/RMD|
stringJSONEncode ( Variant<dictionary, array> input )

Encodes 'input' into a JSON string. Does not require HttpEnabled to be true.

|RMD member="API:Class/HttpService/JSONEncode"|Encodes 'input' into a JSON string. Does not require HttpEnabled to be true.|/RMD|
stringUrlEncode ( string input )

Returns a string with all unsafe ASCII characters replaced by a '%' followed by two hexadecimal values.

|RMD member="API:Class/HttpService/UrlEncode"|Returns a string with all unsafe ASCII characters replaced by a '%' followed by two hexadecimal values.|/RMD|
GenerateGUID ( bool wrapInCurlyBraces = true )
Generates a globally unique identifier.
JSONDecode ( string input )
Decodes a JSON string into a Lua table. Does not require HttpEnabled to be true.
Encodes 'input' into a JSON string. Does not require HttpEnabled to be true.
UrlEncode ( string input )
Returns a string with all unsafe ASCII characters replaced by a '%' followed by two hexadecimal values.

YieldFunctions

YieldFunctions [toggle]

stringGetAsync ( string url, bool nocache = false, dictionary headers = nil )

Sends a HTTP GET request to the supplied URL and returns the response body.

|RMD member="API:Class/HttpService/GetAsync"|Sends a HTTP GET request to the supplied URL and returns the response body.|/RMD|
stringPostAsync ( string url, string data, HttpContentType content_type = ApplicationJson, bool compress = false, dictionary headers = nil )

Performs a HTTP POST request to the supplied URL.

|RMD member="API:Class/HttpService/PostAsync"|Performs a HTTP POST request to the supplied URL.|/RMD|
GetAsync ( string url, bool nocache = false, dictionary headers = nil )
Sends a HTTP GET request to the supplied URL and returns the response body.
PostAsync ( string url, string data, HttpContentType content_type = ApplicationJson, bool compress = false, dictionary headers = nil )
Performs a HTTP POST request to the supplied URL.


|RMD member="API:Class/HttpService"|
Note:This service is not allowed to send requests to any of the ROBLOX websites such as www.roblox.com or api.roblox.com.
This service allows HTTP requests to be sent from game servers. This enables users to create integration with a wide range of third party services such as analytics and storage. One exciting prospect for this service is that if you run and manage your own website, and communicate with it from ROBLOX, it opens the possibility of remote server management and real time communication with the server, through your site. If the limit of 500 requests per minute is exceeded, the Service will stall entirely for approximately 30 seconds. Usage ideas * Cross server marketplace * Real time stock market * Cross server leaderboard Restrictions * Limit of 500 requests a minute (Per server) * Cannot send HTTP requests to the ROBLOX website See also * Sending HTTP requests * User Created Roblox APIs |/RMD|



See also