Nodes

REST API

Prerequisites

In this article we're looking at:

Like most nodes, the REST API node is divided into two main areas. The larger area on the left is for configuring the node and the Preview box on the right lets you test the node with test input data and shows you what the node returns.

Overview of the REST API node

First, let's look at the config area on the left.

Authenticating via Basic, Bearer, Header or OAuth

If the API you're connecting to, requires some form of authentication, FactBranch allows you to store your credentials (username/password, API-key or a token) securely and separately from the node. This way you set the credentials once and then they never again show up in any of our UIs.

We also offer OAuth flows for the most popular data sources.

To use one of the API authentications, first create an authentication.

Then, in your REST API node, select the "Authentication" tab and select the authentication you've just created.

Setting method and URL

At the top of your REST API node select one of the HTTP methods: GET, POST, PUT or DELETE. Right next to the method, paste the URL you want to request data from or send data to.

HTTP method and URL

In the URL you can insert dynamic parameters from a previous node's output. See the section using placeholders below for more info.

Setting the request body

Some requests require a request body to submit data. This is what the big field at the Payload tab is for. Insert a valid JSON body here. You can also use placeholders in the body. See the section using placeholders below for more info.

In order for placeholders to be substituted with real data, we first need to define some test data. So let's look at the Preview box on the right.

Test input data

Most nodes use dynamic data somewhere (more on using placeholders for dynamic data in the next section below) and so it's essential to try out your node with input data.

The Input data is just valid JSON and you can edit is as you like. However, you want to simulate the data this node would receive from its previous node (or from the trigger, if this is the first node).

So, ideally you would first capture a real request to the trigger, use it as test output data and then inherit the output data as the input data of the next node.

To inherit the test outputs from the previous node, click Edit next to the Input data title and then hit inherit outputs from previous node. Your test input will update with the outputs of the previous node or trigger.

Using placeholders

To dynamically insert data in your request body or URL, you can use placeholders. They beginn with a dollar-sign ($) just like variables in many programming languages.

The input data to this node are stored in the $data variable. Let's say your node receives the following data:

{
  "id": 123,
  "email": "alice@example.com",
  "name": "Alice"
}

And let's say you want to use the ID parameter in the URL. You could have the ID inserted dynamically like this:

https://example.com/api/customer/$data.id

Or you want to submit a dynamic request body with the email address and the name. Then the request body would look like this:

{
  "email": $data.email,
  "name": $data.name
}

Running a test request

To see the effects of your query, hit the Run button. This will run the node (but only this single node) for real. So if you're updating data via a real API, your real data will update.

In the test run it will replace all placeholders with the data you've defined in Input data.

After the request finishes, you'll see the outputs in the Output section. This is whatever the API returns and you can work with this data in the next node.

If this is already the final node in the Flow, this output will be returned as the Flow's results.

Renaming the node

To rename the node, either click on Rename next to the title, or double-click on the title itself. Then enter the new name and click on Save or hit Enter on your keyboard. To revert to the old name, hit the Escape key.

Above the Input box you find the quick navigation through the Flow. Use this to get to the previous or the next node.