How do I use HttpService?

I am trying the DevHub info is not helping me

I do not know hwo to get the api version of the web or how to add info to the website

There’s a DataStoreService for data.

I know that I just like doing things the hard way :slight_smile:

Plus then I would have to do this which is messy:

SetAsync(player.UserId,{thing,thing,thing,thing,thing,thing})

I think you’re going too “hard” on yourself, and DataStoreService is the most reliable method of controlling data.

You don’t need to use SetAsync, instead, UpdateAsync to save tables cleanly.

Alongside, with HttpService, web hosting have certain limits to be aware of - such as rate limiting.

I’d personally use HttpService for API purposes, not for data storing as Roblox already offers that.

Ok but I just do not know how to learn it since youtube doesn’t have many good tutorials and DevHub is not too good for it

You do know that using HTTPService would be more messy? You would have to convert all the data into a JSON table then send it to your HTTP server. After receiving the data, you would have to convert it back. There are also security issues with this (unless you’re fine with people seeing the data).

1 Like

You’re not going to learn how to code in NodeJs and Javascript and learn how to write in HTML and CSS from the the dev hub.

1 Like

i just wanted to know how to use it :frowning:

JSONEncode is used to encode a formatted table into a string (suiting JavaScript) to send to the host site. Here’s a sample:

local toEncode = {
    ["title"] = "An example",
    ["desc"] = "to add on" 
} 
local json = HttpService:JSONEncode(toEncode)
print(json) --prints the table in an encoded string

JSONDecode does it oppositely - it turns the encoded string into a LUA table.

GetAsync GETS the information from the URL attached in the parameter.

PostAsync POSTS the information to the URL attached in the parameter.

See more options for the parameters in the documentation.

If you’re wanting to know about other functions, research mutual threads about it and see what it does - alongside, read the documentation beforehand.