Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » How does the scratch API work?
- MyScratchedAccount
-
1000+ posts
How does the scratch API work?
I am wondering how the scratch API works I might use it
Just wondering!
Just wondering!
- ajskateboarder
-
1000+ posts
How does the scratch API work?
To begin, an API is an Application Programming Interface which, in Scratch's case, follows a simple client-server model where the Scratch website - the client - requests data from any of Scratch's APIs (assets, projects, api) to display to the user.
Scratch's API is actually very simple:

(made with Excalidraw btw)
There are actually multiple APIs Scratch has:
Scratch's API is actually very simple:

(made with Excalidraw btw)
There are actually multiple APIs Scratch has:
- api.scratch.mit.edu: a modern general-purpose Scratch API
- assets.scratch.mit.edu: stores costumes for Scratch projects
- projects.scratch.mit.edu: stores the Scratch project data
- scratch.mit.edu/site-api: a weird dingy API which returns user and project comments as HTML
Last edited by ajskateboarder (Jan. 17, 2023 12:52:01)
- ScratchCatHELLO
-
1000+ posts
How does the scratch API work?
it works like all websites do. you ask the server to give you a page and give it some extra details and it sends it back to you. when you open scratch in your browser, that's what happens. the difference is that browsers do all the requesting for you. when you program using an API, you have to handle it yourself.
in python, the de facto way to do this is with the requests library. for example, do:
in python, the de facto way to do this is with the requests library. for example, do:
import requests response = requests.get("link") # you may also include headers if response.status_code = 200: print(response.json()) # .json() produces a dictionary else: print(f"request failed, error code: {response.status_code}")
- OPGalaxyCoder
-
2 posts
How does the scratch API work?
But how do you get the weather using the scratch api
- Discussion Forums
- » Advanced Topics
-
» How does the scratch API work?