How to make an a post request via Roblox script?

Hi. I would like to make a button that follows someone or deletes a badge if I’ll type player’s / badges someone with a Roblox button. It it somehow possible? I found some info about PostAsync thing, but I don’t even know how to make an a post request. Help!

2 Likes

For your use case, you won’t be able to do what you want anyway. Through the use of proxies, you can have your profile follow someone else, but no one else can. I’m not sure about the TOS of that either.


To do a Post request, you would do

local HTTPService = game:GetService("HTTPService")
local URL = ""
local Data = {}

local Result = HTTPService:PostAsync(URL, HTTPService:JSONEncode(Data))
3 Likes

Unfortunately, this is not possible without acquiring a players .ROBLOSECURITY cookie (roblox security cookie) and it is impossible to do so in a game. The badges api and friends api could help with your request if you already have a set .ROBLOSECURITY (you should not make this game public if so).

For the post request, use what @SeargentAUS stated along with a proxy like RoProxy (cannot be trusted since it is an external proxy) or making your own.

3 Likes

IK and understand everything that you wrote above, so it doesn’t have any sense for me. The main question is how can I do it in Roblox Studio?

3 Likes

And who’s using Roblox’s legacy API thing instead of swagger? It doesn’t even have an “Try out” the API function and there’s a lot of good API that was skipped.

3 Likes

My reply was mentioning roblox studio, I don’t know where you got this mind outside of roblox as it mentions “game” not a python script or something. As stated you can use HttpService:PostAsync with your endpoint and pass a header named “Cookie” inside it (you can use the swagger to see what other info it sends), this will be your roblox security cookie. However, you should only use this for self projects and not make it public. There is no way to get a users security cookie in a roblox game and is also against the TOS.

3 Likes

The swagger does have a try out button but the legacy api documents hold a lot more missing api from the original swagger documents, it is your choice.

3 Likes

This wouldn’t work, requests that involve changes to a user require authentication, which involves the .ROBLOSECURITY cookie which is acquired from logging in.

Every HTTP request needing authentication needs the .ROBLOSECURITY cookie.

If you want to delete your own badges with POST requests, you can grab your own cookie, but then you won’t be able to make these requests directly from Roblox anyway.

3 Likes

I know, but how can I make an a post request if I have my cookie and some other info set up?

3 Likes

I would set up your own proxy, don’t trust public proxys with your authentication cookie as they could take it and do actions as you, stealing all your robux, even getting your account deleted.

3 Likes

What are you trying to do?
hfdghgfd

3 Likes

That’s what I mean, BUT I don’t know how to even make a post request

2 Likes

A button on the screen that deletes a badge from my inventory (specific badge) or joins a community

3 Likes

With using a remote event lol*

2 Likes

Well the endpoint URL to delete a badge is “https://badges.roblox.com/v1/user/badges/BADGE_ID_HERE

You would actually send a DELETE request, with proper authentication to allow it succeed.
It’s a Roblox domain URL so you can’t make it from any Roblox game anyway. You need to send the badge ID to a seperate webserver then it can make the delete as you.

2 Likes

Just change roblox to roproxy and it will work, BUT I don’t know how can I make a post request

2 Likes

Fine, if you want to do the request with roproxy, lemme make the script real quick.

This is very dangerous.

2 Likes

It’s not, because only I will be able to click the button because of the checkout and I’ll save my cookie to the datastore service

2 Likes
local http = game:GetService("HttpService")

local URL = "https://badges.roblox.com/v1/user/badges/"

local COOKIE = ""

function deleteBadge(badgeId)
	local temp = URL .. tostring(badgeId)
	local req = http:RequestAsync(
		{
			Url = temp,
			Method = "DELETE",
			Headers = {
				Cookie = COOKIE
			}
		}
	)
end

Let me add results hold up.

1 Like

Alr, thank you bro for this one

2 Likes