Hello, fella devs,
I’m trying to learning something new… And I’m interested in HttpService. But I need a simple explanation… What is HttpService for? What does HttpService:GetAsync() can do? How can I use HttpService:RequestAsync() for all website?
HTTPService allows http requests to be sent using HttpService:GetAsync(), HttpService:RequestAsync() and HttpService:PostAsync()
It is quite useful for communication also with JSON services. I personally have used it with webhooks. You can use it for many stuff, there are options how to use it.
Read more: HttpService | Roblox Creator Documentation
1 Like
Httpservice allows for direct communication to and from websites.
Here is a example script that uses a free api to get the price of bitcoin.
local url = "https://api.coindesk.com/v1/bpi/currentprice.json" -- free api that has bitcoin prices
local web = game:GetService("HttpService")
local result = web:GetAsync(url) -- grabs the data from the url
print(result) -- would be JSON which is unusable for lua
local LUA_RESULT = web:JSONDecode(result) -- turns JSON into a dictionary
print(LUA_RESULT)
You can search up free apis to play with and you can find a whole bunch of urls to play with.
GET grabs data from a server/url.
POST sends data to a url/server.
One example of POST could be to make a discord webhook send a message. This is the most common use of POST.
1 Like