API Connector

Updated by Karan

In this step-by-step guide, you will understand how to configure a Simple HTTP call to your website or application. The core benefit of a simple HTTP node from Byteline is that you don't need to code anything to make an HTTP call, which can be used to make a call to a third-party system.

Let's get started.

Add API Connector node

Step - 1: To create a flow design check the How to create your first flow design.

Step - 2: To add a Simple HTTP node, click on the add button over the top-left corner of the node.

Step -3: Enter the name for your flow

Step - 4: Select the Simple HTTP node to add it to your flow.

Step - 5: Now click on the edit button to start configuring the simple HTTP node.

Step - 6: Select the HTTP Method to call the URL.

Step - 7: Enter the API URL linked to your backend or third-party web service to access the data from the database via a simple HTTP(S) request.

Step - 8: Only JavaScript Object Notation (JSON) or form-data for the POST call method is accepted in the body. Enter the data in JSON like shown below.

Step - 9: Click the form-data option to select it.

Step - 10: In the form-data, data is entered in key-value pair as shown below:

Supported HTTP Methods

There are 4 methods to call the URL but in every method, the URL shall stay the same.

1. GET Method: This method is used for retrieving the data.

Note: Only header is allowed In GET method

2. POST Method: This method is used for sending the data when the call can perform some resource modification.

Note: You can configure both body and header in POST method

Only JavaScript Object Notation (JSON) or form-data for the POST call method is accepted in the body.

3. PUT Method: This method is used to update the data entered in the database.

You can have JSON or form body even with the PUT method.

4. DELETE Method: This method is used to delete a record in the database.

Step - 11: Configure headers.

The configured HTTP API endpoint might require passing specific headers. These can be configured using the Header tab. Headers are key-values pairs that can be specified using this tab.

Step - 12: Successful configuration window will appear like this:

Once you save the configuration, the indicator over the top-right corner of the node will turn to green.

The green indicator shows that the simple HTTP node is successfully configured to your flow.

Your simple HTTP node has been configured successfully. Feel free to connect us for any doubt.

Using Variables

You can use the key-to-variable mappings to refer to flow variables in the code. Multiple mappings are supported. These keys can then be used anywhere in the API Connector configuration using {{key}} notation.

When this task runs, the keys will be replaced by their values.

Pagination

Simple HTTP task also supports pagination method to easily fetch multiple pages from a GET call by using a simple dropdown. Below methods are supported for pagination. You should pick the method based on the pagination process supported by the API being called. This is usually pretty prominent in the API documentation.

None

This means the pagination is off.

Count-based Offset

This pagination method works by sending offset query param in the URL. This parameter specifies the starting index of the page to fetch. This query parameter is automatically added to the GET request by Byteline to retrieve all the records by sending multiple GET requests.

The response needs to have the following fields for this pagination to work correctly.

  • offset: This indicates the starting offset of the response data
  • count: The number of records in the response
  • total: The total number of records that are available

The following alternate names are supported for offset and total

  • offset: offset, start
  • total: total, totalResults
Cursor-based Offset

This pagination method also works by sending offset in the query params, but it's a text-based offset. This offset indicates to the host API the beginning of the next page. This query parameter is automatically added to the GET request by Byteline to retrieve all the records by sending multiple GET requests.

The response needs to have the following fields in the response body for this pagination to work correctly.

  • offset: This indicates the text-based offset that should be passed to get the next page.
  • has_more: Optional. If present, next page call is only made when its value is true

The following alternate names are supported for offset and has_more

  • offset: offset, after
  • has_more: has_more

Headers

API Connector headers are typically used to pass the Authorization token and optionally other HTTP request information. You can get these values from your third-party account and its API documentation. Below is a sample screen using Authorization and Content-Type headers.

The Content-Type header if required is usually set to application/json.


How did we do?