πWeb Fetcher Block
Last updated
Last updated
Advanced/Experimental Contact us or join Discord to report issues
The WebFetcher block can be used to make GET and POST requests to HTTP endpoints
This is useful for both fetching data (via GET) and sending data, usually JSON, to various APIs endpoints (via POST).
You can build a JSON payload inside the body
field that re-uses {variables} from other blocks, allowing you to dynamically construct payloads based on user inputs or image or text blocks.
You can use a simple jq-style dot-notation syntax like ".name" to fetch a specific field from a JSON response. e.g. given a GET of the following JSON response:
You would use the selector data.description
in the WebFetcher in order to fetch "I am the walrus"
Alternately, we sometimes build simple vals for doing more complex data processing. See below.
We often use code platforms like Val.town or Replit to build and work with simple APIs from glifs. Here's a few examples
Val to get current weather in a location: https://www.val.town/v/jamiedubs/weatherLivestream
Val to fetch the image URL for a given Ethereum NFT https://www.val.town/v/jamiedubs/nftImage
Val for storing & fetching data (demonstrates GET + POST in one val + use of Valtown's blob storage for persistence): https://www.val.town/v/jamiedubs/databin