# ReST

## Introduction

The ReST Action in DBSync Cloud Workflow enables users to interact with any ReSTful web service within their workflows. This action is versatile and allows you to send HTTP requests, enabling seamless integration with various external services and APIs. This guide provides step-by-step instructions on setting up, configuring, and using the ReST action effectively.

<figure><img src="https://1036205596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv9avy716UiAsS24zOznZ%2Fuploads%2FMYAl96I9xmeklB1eIBEa%2Funknown.jpeg?alt=media&#x26;token=6435018a-6308-47d9-8918-8d6187c70252" alt=""><figcaption></figcaption></figure>

## Prerequisites

* An active DBSync Cloud Workflow account.
* A fully configured OpenAPI Connector.
* The endpoint URL of the ReSTful web service you intend to connect to.
* API credentials (if required by the endpoint) and necessary access permissions.

## Set Up a ReST Action

#### Configure the ReST Action

1. In the Flow screen, drag the **Flow** Action from the **Actions** palette on the left and drop to the center of the screen.
2. Click **Configure** on the flow panel to configure the flow. &#x20;
3. In the **Flow configuration** panel that opens on the right side, enter the required description for the flow and click **Save**.
4. Drag and drop the **ReST** action from the list of available actions.
5. Enter the following details:
   1. **Select Source**: From the dropdown, select the required source.
   2. **Select Method**: Choose the HTTP method (*GET*, *POST*, *PUT*, *DELETE*, *PATCH*, *HEAD*).
   3. **Relative URL**: Provide the full URL of the API endpoint.

      <figure><img src="https://1036205596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv9avy716UiAsS24zOznZ%2Fuploads%2Fc3uSJwVPbKFkiZeLY3Ya%2Funknown.jpeg?alt=media&#x26;token=2e14d327-837e-45cf-b0ee-339076c63c3b" alt=""><figcaption></figcaption></figure>
6. **Configure API** :
   1. **Parameters**: Specific values, like query strings, headers, or path variables that you can set to customize your API requests. They help to define the data that you want to send to or receive from the API. By configuring these parameters appropriately, you can ensure that your request is tailored to meet the needs of the API you're interacting with. Specify any query strings needed by the endpoint.
   2. **Headers**: Key-value pairs that you can configure to provide essential information to the API, such as authentication credentials, content type, or any other metadata that the server needs to process your request correctly. Set these headers in the Headers tab when setting up your API call. Add custom headers such as Content-Type or Authorization for authenticated requests.
   3. **Request**: Select between **None**, **Raw**, and **Binary** Request.&#x20;
   4. **Metadata**: Data that describes other data and structures involved in the API interaction. It can include details about the schema design, business rules, and processes that govern how the data is structured and utilized.

<figure><img src="https://1036205596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv9avy716UiAsS24zOznZ%2Fuploads%2FPngbnR0TblzpbVPb41kM%2Funknown.png?alt=media&#x26;token=685bb414-c3a6-40a0-8950-5939f4942047" alt=""><figcaption></figcaption></figure>

#### Executing a ReST Action

**Test the Action**

1. Save your workflow configuration.
2. Click **Run** <img src="https://1036205596-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv9avy716UiAsS24zOznZ%2Fuploads%2FoqI6kOY5fxBuLbsqa1qs%2Funknown.png?alt=media&#x26;token=215af27c-4507-4045-af54-29c40c1393d1" alt="" data-size="line"> to execute the ReST Action and observe the response.
3. Review the response data and logs to ensure the action works as intended.

**Use the Response**

* **Capture Output**: Store response data for use in subsequent workflow steps by mapping output fields.
* **Conditional Logic**: Set conditions based on response status codes (For example, `200 OK`, `400 Bad Request`) to control workflow behavior.

## Common Use Cases

#### Retrieve Data from an External API

1. Select **GET** as the method.
2. Provide the **Endpoint URL** and any necessary headers.
3. Run the workflow to retrieve data, and map the response fields for use in downstream actions.

#### Send Data to a Third-Party Service

1. Select **POST** or **PUT** as the method.
2. Configure the **Body** with data mapped from previous workflow steps.
3. Include any required headers (e.g., `Content-Type: application/json`).
4. Test and save the action to send data.

#### Update Data via PATCH Request

1. Choose **PATCH** and specify the **Endpoint URL**.
2. Include the partial data in the **Body** that you want to update.
3. Save and execute the workflow to make the update.

## Advanced Configuration

**Dynamic Variables in URLs and Headers**

* Use Placeholders (for example, {{variable\_name}}) in the URL, headers, or body to dynamically insert data at runtime.

**Handling Large Payloads**

* For large payloads, ensure the endpoint supports chunked transfer or increase the timeout setting in the ReST Action to avoid interruptions.

## Error Handling and Debugging

#### **Common Issues**

* 401 Unauthorized: Check authentication credentials and token validity.
* 404 Not Found: Verify that the endpoint URL and resource path are correct.
* Timeout Errors: Increase the action timeout or check the network status.

#### **Debugging Tips**

* Log Responses: Enable response logging to capture the details of API interactions.
* Use Test Mode: Run the ReST Action in test mode to monitor real-time response data without affecting production workflows.

## Best Practices

* Secure API Keys: Store API keys in a secure environment and avoid hardcoding them in workflows.
* Optimize API Calls: Minimize API calls by using only necessary data fields and parameters.
* Monitor API Limits: Be aware of the rate limits imposed by the API provider to prevent overuse.

The ReST Action in DBSync Cloud Workflow provides a powerful way to connect with and automate data flows involving any RESTful service. By following this guide, users can configure and execute ReST Actions effectively to enhance their workflow automation and data integration processes.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mydbsync.com/cloud-workflow/2026_create-your-workflow/action/rest.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
