Try It Out
Overview of the Test
Here’s a quick overview of what you’ll be doing in this test:
- Login: Signing in as
demo@laminar.run
. - Initial Payload: Making a GET Request to https://source.test.laminar.run/ to see what the payload looks like before Laminar transforms it en route.
- Run a Flow: Running a Flow that was predefined on
demo@laminar.run
’s account that renamesdescription
tonew_field1
in transit (i.e. before the response from Laminar arrives.)
Note: This is a super simple example. Laminar supports more than just the
rename_key
operation, and there are differentflow_types
you can learn about from our Concepts (🚧 under construction 🚧) section of the documentation.
Behind the Scenes
Here’s an explanation of what happened behind the scenes to make this work using the Laminar API:
- Account Creation: We first had to create an Account.
- Workspace Setup: With that account, we created a Workspace and an API key for that workspace.
- Node Creation: We then created a Node for the Source we wanted to GET data from.
- Flow Creation: We then created a Flow that would GET data from the Source Node, and rename the
description
key tonew_field1
in transit.
Creating a Node
(A definition of an API in Laminar).
Once we created our workspace, we defined the Source Node for the Flow we wanted to execute.
Here’s the payload we sent to
/nodes/workspaces/:workspace_id
to create our Node. You can read more about flow types here (🚧 under construction 🚧).
{
"node": {
"url": "https://source.test.laminar.run/",
"description": "Our Example Source Node",
"name": "ex-source-node",
"metadata": {
"auth": {
"type": "none"
},
"headers": {
"Accept": "application/json",
"Content-Type": "application/json"
}
}
}
}
Creating a Flow
(A definition of the operation that Laminar should execute)
- Initial Steps: Now that we’d created our Node, we could then begin to define our Flow.
- Flow Type: In our case, we want to use a Flow with a
flow_type
ofpulley
, since we want to get data from a source, transform it, and then respond with the transformed data.
Here’s the payload we sent to
/flows/workspaces/:workspace_id
to create our Flow. You can read more about flow types here (🚧 under construction 🚧).
{
"flow_type": "pulley",
"flow": {
"description": "Demo Pulley Flow.",
"name": "pulley-flow",
"mapping": {
"operation_type": "pulley",
"source": {
"name": "ex-source-node",
"fields": [
{
"name": "description"
},
{
"name": "id"
}
]
},
"destination": {
"name": "none"
},
"operations": [
{
"type": "map",
"params": {
"function": "rename_keys",
"input": {
"from": "description",
"to": "new_field1"
}
}
}
]
}
}
}
Executing the Flow.
We can then execute the flow by sending a POST request to /flows/run/:flow_id
, with our api_key
in the body of the request.
Here’s what the data looks like before it’s transformed by Laminar.
{
"data": {
"description": "Hello World!",
"id": "1"
}
}
Here’s an example response from the exectution of our Flow.
{
"data": {
"completed_at": "2023-09-07T02:38:39Z",
"id": "3a492878-4cfa-4e58-a3cf-6633f4da7529",
"result": {
"id": "1",
"new_field1": "Hello World!"
},
"started_at": "2023-09-07T02:38:39Z",
"status": "completed"
}
}
Want to learn more?
Was this page helpful?