> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rwsintegration.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration with multiple extractions

> Learn how to extract data from multiple sources in a single integration

This guide walks you through creating an integration that extracts post data from JSONPlaceholder, enriches each post with comment details using a secondary API call, and delivers the combined data to a webhook endpoint. By the end, you'll understand how to use the Enrichment phase to fetch additional data per datapoint and combine it in your transformations.

## What you'll build

You'll create an integration that:

1. **Extracts** post records from JSONPlaceholder (a free test API)
2. **Enriches** each post by fetching its comments using a secondary API request
3. **Transforms** the data by combining fields from both the extract and enrichment responses
4. **Loads** the enriched results to webhook.site where you can inspect them

Time required: approximately 5 minutes.

## Prerequisites

* Access to an RWS Integration Workspace
* A web browser

## Step 1: Set up your destination

Before building the integration, create a destination endpoint where you can verify the results.

1. Open [webhook.site](https://webhook.site) in a new browser tab
2. The site automatically generates a unique URL (e.g., `https://webhook.site/abc123-def456-...`)
3. **Copy the unique path portion** (e.g., `/abc123-def456-...`); you'll need it when configuring the Load phase
4. Keep this tab open to monitor incoming requests

<Note>
  webhook.site is a free service that captures and displays HTTP requests. It's useful for testing integrations before connecting to real destination systems.
</Note>

## Step 2: Create the source Connection

Connections define how RWS Integration communicates with external systems. You'll create one for the JSONPlaceholder API, which will be used for both the main extract and the enrichment requests.

1. In the sidebar, click **Connections**
2. Click **New Connection**
3. Configure the connection:

| Field          | Value                                  |
| -------------- | -------------------------------------- |
| Name           | `[Doc] Enrichment Extract Connection`  |
| Type           | `API`                                  |
| URL            | `https://jsonplaceholder.typicode.com` |
| Base Path      | `/`                                    |
| Authentication | `No authentication`                    |

4. Click **Save**

The JSONPlaceholder API doesn't require authentication, so the **No authentication** option (already selected by default for new connections) is all you need.

## Step 3: Create the destination Connection

Now create a Connection for your webhook.site destination.

1. Click **New Connection**
2. Configure the connection:

| Field          | Value                              |
| -------------- | ---------------------------------- |
| Name           | `[Doc] Enrichment Load Connection` |
| Type           | `API`                              |
| URL            | `https://webhook.site`             |
| Base Path      | `/`                                |
| Authentication | `No authentication`                |

3. Click **Save**

## Step 4: Create the Integration

With both Connections ready, create the Integration that extracts posts, enriches them with comments, and delivers the combined data to your destination.

1. In the sidebar, click **Integrations**
2. Click **New Integration**

### General settings

Configure the basic integration properties:

| Field       | Value                                          |
| ----------- | ---------------------------------------------- |
| Name        | `[Doc] Enrichment Integration`                 |
| Version     | `1.0.0`                                        |
| Type        | `Full`                                         |
| Environment | `Staging`                                      |
| Schedule    | Daily, at a time of your choice (e.g. `09:00`) |

### Extract phase

The Extract phase retrieves post data from your source system.

1. Expand the **Extract** section
2. Configure these fields:

| Field      | Value                                 |
| ---------- | ------------------------------------- |
| Connection | `[Doc] Enrichment Extract Connection` |
| Method     | `GET`                                 |
| Path       | `/posts`                              |

3. Set the **Datapoint Path in Response** to `root`

4. Set the **Pagination**:

| Field                  | Value    |
| ---------------------- | -------- |
| Pagination Type        | `Simple` |
| Page size parameter    | `_limit` |
| Page size value        | `10`     |
| Initial page parameter | `_page`  |
| Initial page value     | `1`      |
| Pagination end type    | `Object` |

5. Check the **Extract Preview** panel on the right side. It should show:
   * Status: `200 OK`
   * A single post record (the Datapoint) like this:
   ```json theme={null}
   {
        "userId": 1,
        "id": 1,
        "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
        "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto"
    }
   ```

### Enrichment phase

The Enrichment phase fetches additional data for each datapoint extracted in the main Extract phase. For each post, we'll fetch its comments.

1. Expand the **Enrichment** section
2. Click **Add Enrichment**
3. Configure the enrichment:

| Field      | Value                                 |
| ---------- | ------------------------------------- |
| Name       | `comments`                            |
| Connection | `[Doc] Enrichment Extract Connection` |
| Method     | `GET`                                 |
| Path       | `/posts/{{ parameterId }}/comments`   |

Set Enrichment query parameters:

| Type  | To            | Fixed value |
| ----- | ------------- | ----------- |
| Fixed | `parameterId` | `{{ id }}`  |

<Warning>
  The `{{ id }}` is a dynamic parameter that will be interpolated from each datapoint extracted in the main Extract step. Make sure the field name matches exactly (case-sensitive).
</Warning>

4. The enrichment will automatically use the `id` value extracted from the post to make a request to `/posts/{id}/comments`.

5. Check the **Extract Preview** panel on the right side. It should show:
   * Status: `200 OK`
   * An array of comment records like this:
   ```json theme={null}
   [
    {
        "postId": 1,
        "id": 1,
        "name": "id labore ex et quam laborum",
        "email": "Eliseo@gardner.biz",
        "body": "laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium"
    },
    {
        "postId": 1,
        "id": 2,
        "name": "quo vero reiciendis velit similique earum",
        "email": "Jayne_Kuhic@sydney.com",
        "body": "est natus enim nihil est dolore omnis voluptatem numquam\net omnis occaecati quod ullam at\nvoluptatem error expedita pariatur\nnihil sint nostrum voluptatem reiciendis et"
    },
   ]
   ```

### Transform phase

The Transform phase maps source fields from both the Extract and Enrichment responses to your destination format. For this guide, create mappings that combine post data with comment information.

1. Expand the **Transform** section
2. Click **Add Transformation** and configure fields from the main Extract:

| Type   | To          | From    |
| ------ | ----------- | ------- |
| Simple | `postId`    | `id`    |
| Simple | `postTitle` | `title` |
| Simple | `postBody`  | `body`  |

3. Click **Add Transformation** again and configure fields from the Enrichment:

| Type   | To                  | From                |
| ------ | ------------------- | ------------------- |
| Simple | `firstCommentEmail` | `comments[0].email` |
| Simple | `firstCommentText`  | `comments[0].body`  |

<Warning>
  To access enrichment data, use the enrichment name directly as the start of the path: `{{ enrichmentName }}.{{ fieldPath }}` (in this case, `comments`). The enrichment name must match exactly what you configured in the Enrichment section.
</Warning>

4. Check the **Transform Preview** panel. It should display:

```json theme={null}
{
  "postId": 1,
  "postTitle": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "postBody": "quia et suscipit...",
  "firstCommentEmail": "Eliseo@gardner.biz",
  "firstCommentText": "laudantium enim quasi est quidem magnam voluptate..."
}
```

This confirms your mappings are working correctly and shows how data from both Extract and Enrichment phases are combined.

### Load phase

The Load phase sends transformed data to your destination.

1. Expand the **Load** section
2. Configure these fields:

| Field      | Value                                                      |
| ---------- | ---------------------------------------------------------- |
| Connection | `[Doc] Enrichment Load Connection`                         |
| Method     | `POST`                                                     |
| Path       | Your webhook.site unique path (e.g., `/abc123-def456-...`) |
| Load Type  | `Simple`                                                   |

<Warning>
  Copy only the path portion from your webhook.site URL. If your full URL is `https://webhook.site/abc-123`, enter `/abc-123` as the Path.
</Warning>

3. Check the **Load Preview** panel. It shows the complete request that will be sent:
   * **Path**: [https://webhook.site/\{\{](https://webhook.site/\{\{) your-unique-path }}
   * **Method**: POST
   * **Request Body**:

```json theme={null}
{
  "postId": 1,
  "postTitle": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "postBody": "quia et suscipit...",
  "firstCommentEmail": "Eliseo@gardner.biz",
  "firstCommentText": "laudantium enim quasi est quidem magnam voluptate..."
}
```

## Step 5: Deploy the Integration

1. Toggle **Deployment** to enabled
2. Click **Create Integration**

The integration will now run automatically every day at the time you chose.

## Step 6: Run it now

You don't need to wait for the schedule. Trigger the first run manually:

1. Open your integration from the **Integrations** list
2. Click **Run now**, next to the **Save** button
3. Confirm in the dialog, and a **Run started** message appears

## Step 7: Verify the results

Switch to your webhook.site browser tab. You should see incoming POST requests (one for each post processed), each containing your transformed data structure with combined post and comment information:

```json theme={null}
{
  "postId": 1,
  "postTitle": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "postBody": "quia et suscipit...",
  "firstCommentEmail": "Eliseo@gardner.biz",
  "firstCommentText": "laudantium enim quasi est quidem magnam voluptate..."
}
```

Congratulations, you've built and run your first integration with enrichment!

## What you learned

* **Connections** store configuration for external systems and can be reused across multiple Integrations
* **Integrations** follow the Extract → Enrichment → Transform → Load pattern
* **Preview panels** automatically update as you configure each phase, letting you validate before running
* **Simple transformations** map fields from source to destination using JSONPath notation
* **Enrichment** allows you to fetch additional data for each datapoint extracted in the main Extract phase
* **Dynamic parameters** (like `{{ id }}`) in enrichment paths are interpolated from extracted datapoints
* **Enrichment data** is accessed in Transform by enrichment name: `{{ enrichmentName }}.{{ fieldPath }}`

## Next steps

<CardGroup cols={2}>
  <Card title="Connections" icon="plug" href="/en/features/connections/api">
    Learn about different authentication methods
  </Card>

  <Card title="Pagination" icon="arrows-rotate" href="/en/features/extract/pagination">
    Handle pagination and complex API responses
  </Card>

  <Card title="Business Rules" icon="code" href="/en/features/business-rules/overview">
    Master field transformations with JavaScript
  </Card>

  <Card title="Scheduling" icon="clock" href="/en/features/extract/scheduling">
    Schedule your integrations to run automatically
  </Card>
</CardGroup>
