Discuss Scratch

FriskVRYT
Scratcher
18 posts

How do I make a POST request to Scratch servers?

Trying to learn how to do this type of stuff and I want to know how to make a POST request to follow a user's account.
Penthusiast
Scratcher
56 posts

How do I make a POST request to Scratch servers?

FriskVRYT wrote:

Trying to learn how to do this type of stuff and I want to know how to make a POST request to follow a user's account.

Yeah so the route for this is https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME

In this case, replace the target with the person you're trying to follow, and yourname with your username. You will need to send a scratchcsrftoken along with that request to authenticate it's you.
gem1001
Scratcher
1000+ posts

How do I make a POST request to Scratch servers?

Penthusiast wrote:

Yeah so the route for this is https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME

In this case, replace the target with the person you're trying to follow, and yourname with your username. You will need to send a scratchcsrftoken along with that request to authenticate it's you.
That would make a GET request, not a POST request.



There are a few ways to make a POST request; a simple method is to use JavaScript's window.fetch() in the browser console:
fetch('put whatever URL inside these quotes', {'method': 'POST'});

Last edited by gem1001 (May 12, 2026 17:21:59)

Penthusiast
Scratcher
56 posts

How do I make a POST request to Scratch servers?

gem1001 wrote:

Penthusiast wrote:

Yeah so the route for this is https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME

In this case, replace the target with the person you're trying to follow, and yourname with your username. You will need to send a scratchcsrftoken along with that request to authenticate it's you.
That would make a GET request, not a POST request.



There are a few ways to make a POST request; a simple method is to use JavaScript's window.fetch() in the browser console:
fetch('put whatever URL inside these quotes', {'method': 'POST'});

I was just giving the url, not the necessary code to do it. You can also do it via a terminal command such as

curl -X POST https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME -H "Referer: https://scratch.mit.edu/" -H "User-Agent: Mozilla/5.0"

but again you will need to provide a csrftoken to authenticate.
FriskVRYT
Scratcher
18 posts

How do I make a POST request to Scratch servers?

Penthusiast wrote:

gem1001 wrote:

Penthusiast wrote:

Yeah so the route for this is https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME

In this case, replace the target with the person you're trying to follow, and yourname with your username. You will need to send a scratchcsrftoken along with that request to authenticate it's you.
That would make a GET request, not a POST request.



There are a few ways to make a POST request; a simple method is to use JavaScript's window.fetch() in the browser console:
fetch('put whatever URL inside these quotes', {'method': 'POST'});

I was just giving the url, not the necessary code to do it. You can also do it via a terminal command such as

curl -X POST https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME -H "Referer: https://scratch.mit.edu/" -H "User-Agent: Mozilla/5.0"

but again you will need to provide a csrftoken to authenticate.
I have my crsf token saved somewhere i think, how do i provide it to the server?
Penthusiast
Scratcher
56 posts

How do I make a POST request to Scratch servers?

FriskVRYT wrote:

Penthusiast wrote:

gem1001 wrote:

Penthusiast wrote:

Yeah so the route for this is https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME

In this case, replace the target with the person you're trying to follow, and yourname with your username. You will need to send a scratchcsrftoken along with that request to authenticate it's you.
That would make a GET request, not a POST request.



There are a few ways to make a POST request; a simple method is to use JavaScript's window.fetch() in the browser console:
fetch('put whatever URL inside these quotes', {'method': 'POST'});

I was just giving the url, not the necessary code to do it. You can also do it via a terminal command such as

curl -X POST https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME -H "Referer: https://scratch.mit.edu/" -H "User-Agent: Mozilla/5.0"

but again you will need to provide a csrftoken to authenticate.
I have my crsf token saved somewhere i think, how do i provide it to the server?


Try something like

const request = await fetch('https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME', {
    method: "POST",
    headers: {
        "Referer": "https://scratch.mit.edu/",
        "User-Agent": "Mozilla/5.0",
        "X-CSRFToken": TOKEN HERE
    }
});
Penthusiast
Scratcher
56 posts

How do I make a POST request to Scratch servers?

Penthusiast wrote:

FriskVRYT wrote:

Penthusiast wrote:

gem1001 wrote:

Penthusiast wrote:

Yeah so the route for this is https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME

In this case, replace the target with the person you're trying to follow, and yourname with your username. You will need to send a scratchcsrftoken along with that request to authenticate it's you.
That would make a GET request, not a POST request.



There are a few ways to make a POST request; a simple method is to use JavaScript's window.fetch() in the browser console:
fetch('put whatever URL inside these quotes', {'method': 'POST'});

I was just giving the url, not the necessary code to do it. You can also do it via a terminal command such as

curl -X POST https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME -H "Referer: https://scratch.mit.edu/" -H "User-Agent: Mozilla/5.0"

but again you will need to provide a csrftoken to authenticate.
I have my crsf token saved somewhere i think, how do i provide it to the server?


Try something like

const request = await fetch('https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME', {
    method: "POST",
    headers: {
        "Referer": "https://scratch.mit.edu/",
        "User-Agent": "Mozilla/5.0",
        "X-CSRFToken": TOKEN HERE
    }
});


Actually I'm looking at a real request and it's a bit more then that. It's sending the cookies as well.
FriskVRYT
Scratcher
18 posts

How do I make a POST request to Scratch servers?

Penthusiast wrote:

FriskVRYT wrote:

Penthusiast wrote:

gem1001 wrote:

Penthusiast wrote:

Yeah so the route for this is https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME

In this case, replace the target with the person you're trying to follow, and yourname with your username. You will need to send a scratchcsrftoken along with that request to authenticate it's you.
That would make a GET request, not a POST request.



There are a few ways to make a POST request; a simple method is to use JavaScript's window.fetch() in the browser console:
fetch('put whatever URL inside these quotes', {'method': 'POST'});

I was just giving the url, not the necessary code to do it. You can also do it via a terminal command such as

curl -X POST https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME -H "Referer: https://scratch.mit.edu/" -H "User-Agent: Mozilla/5.0"

but again you will need to provide a csrftoken to authenticate.
I have my crsf token saved somewhere i think, how do i provide it to the server?


Try something like

const request = await fetch('https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME', {
    method: "POST",
    headers: {
        "Referer": "https://scratch.mit.edu/",
        "User-Agent": "Mozilla/5.0",
        "X-CSRFToken": TOKEN HERE
    }
});
This can be executed via browser console correct?
Penthusiast
Scratcher
56 posts

How do I make a POST request to Scratch servers?

FriskVRYT wrote:

Penthusiast wrote:

FriskVRYT wrote:

Penthusiast wrote:

gem1001 wrote:

Penthusiast wrote:

Yeah so the route for this is https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME

In this case, replace the target with the person you're trying to follow, and yourname with your username. You will need to send a scratchcsrftoken along with that request to authenticate it's you.
That would make a GET request, not a POST request.



There are a few ways to make a POST request; a simple method is to use JavaScript's window.fetch() in the browser console:
fetch('put whatever URL inside these quotes', {'method': 'POST'});

I was just giving the url, not the necessary code to do it. You can also do it via a terminal command such as

curl -X POST https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME -H "Referer: https://scratch.mit.edu/" -H "User-Agent: Mozilla/5.0"

but again you will need to provide a csrftoken to authenticate.
I have my crsf token saved somewhere i think, how do i provide it to the server?


Try something like

const request = await fetch('https://scratch.mit.edu/site-api/users/followers/TARGET/add/?usernames=YOURNAME', {
    method: "POST",
    headers: {
        "Referer": "https://scratch.mit.edu/",
        "User-Agent": "Mozilla/5.0",
        "X-CSRFToken": TOKEN HERE
    }
});
This can be executed via browser console correct?

Yes it's just javascript, but from my tests you need to send the cookies as well (session token and csrf token, etc)

Powered by DjangoBB