REST

How to Use the REST API Connector in DBSync Cloud Workflow

Overview

The REST API Connector in DBSync Cloud Workflow allows users to connect to external APIs and perform various operations such as GET, POST, PUT, PATCH, and DELETE. This connector enables seamless integration with web services, allowing users to send and receive data programmatically.

Steps to Use the REST API Connector

Create REST API Connection

  1. General Settings:

  • Name (required): Enter a unique name for the connection for easy reference in actions.

  • Mode (required): Choose between:

  • Cloud: For connecting to publicly accessible applications (e.g., Salesforce).

  • On-premise: For connecting to applications behind a firewall. This requires an agent to be installed on a computer with network access to the on-premise application.

  • Base URL (required): Enter the common part of the API’s URL used across all HTTP endpoints.

Configure HTTP Headers (Optional)

  1. If needed, include custom HTTP headers with your API requests:

  • Key: Enter the header name (e.g., Authorization).

  • Value: Enter the corresponding header value.

Configure Authentication

  1. Auth Type (required): Choose the authentication method: Basic

  • Username (required): Enter the basic authentication username.

  • Password (required): Enter the password for this account.

  • OAuth 1.0 or OAuth 2.0: Follow the necessary steps for these authentication methods if applicable.

Test the Connection

  1. Click the Test Connection button to verify that the connection is set up correctly and free of errors.

Configure API Request

  1. HTTP Method: Select the desired HTTP method from the dropdown (GET, POST, PUT, PATCH, DELETE).

  2. Relative URL: Enter the relative URL for the API endpoint. You can use variables by clicking the Fx icon.

Send the Request

  1. Click the Send button to process the API request. The output will be displayed below.

Configure Request Body (if applicable)

  1. Request Body Tab: Define the body of the request for POST, PUT, PATCH, or DELETE methods:

  • None: No data sent in the request body (typically for GET requests).

  • Raw: Enter the data in JSON or XML format.

View Output

  1. Response Tab: After sending the request, view the server's response:

  • Status Code: Indicates the result of the request (e.g., 200 OK, 404 Not Found).

  • Response Body: The content returned by the server, viewable in different formats (Pretty or Raw).

  • Headers: Metadata associated with the response.

Review Request Details

  1. Request Tab: Review the details of the request you sent to the server, including parameters and headers.

Example Workflow

  1. Login to DBSync Cloud Workflow.

  2. Create a new project and add a task for REST API operations.

  3. Add the REST API Connector and configure it with the desired connection and HTTP method.

  4. Set up parameters, headers, and the request body as needed.

  5. Send the request and review the response to ensure the operation was successful.

Pro Tip

PRO TIP

Use environment variables for sensitive information such as API keys and tokens. This enhances security by keeping credentials out of the codebase and makes it easier to update credentials across multiple workflows.

Frequently Asked Questions (FAQ)

1. What types of authentication are supported by the REST API Connector?

The REST API Connector supports various authentication methods, including Basic Authentication, OAuth, and API key authentication. You can set these in the Headers tab.

2. How can I handle pagination in API responses?

To handle pagination, you can use variables to store pagination tokens or offsets and loop through the API requests until all pages are retrieved. Use the Fx button to manage these variables dynamically.

3. Can I use the REST API Connector to send files?

Yes, you can use the POST or PUT methods with the appropriate Content-Type header (e.g., multipart/form-data) to upload files. Define the file content in the Request Body tab.

4. How do I handle errors in API responses?

You can check the Status Code in the Response tab to determine if the request was successful. For handling errors, use conditional actions in your workflow to manage different status codes and responses appropriately.

Last updated