Persist data outside a flow
Data in flows is transient by default. Whatever data the flow retrieves or processes is cleared or replaced when the flow runs again. But you can design flows to persist data by sending it to an external data store, where you can retrieve it later.
Recipe
The following recipe shows how to persist data with JSONbin.io:
-
Create a JSONbin.io account and locate the
x-master-keyAPI key. -
Create a flow and add an HTTP Request block with a GET request to this URL:
-
Connect an Evaluate block to the HTTP Request block’s Success port.
-
In the Evaluate block, change
value1toitemsand give it the pathbody.works. Then click Start writing TypeScript and enter the following code:This will create an array of book titles from the HTTP Request block’s response.
-
Add an HTTP Request block and create a POST request with the following URL:
-
Add an
x-master-keyheader to the request. Use your JSONbin.io API key as the header’s value. -
Add a variable named
{{body}}to the POST request’s body. -
Connect the Evaluate block’s Result port to the HTTP Request block’s body variable input port.
-
Run the flow. The POST request sends the array of book titles to a new bin at JSONbin.io.
To access the posted data, you can send a GET request to https://api.jsonbin.io/v3/b/(binId)/latest using your x-master-key API key. You can find the binID in the POST response body’s metadata.
Try it out
To see this recipe’s completed flow, check out Cookbook: Persist data outside a flow. You can also clone this flow to your workspace to experiment with it.