# patch

## Overview

This endpoint is used for updating information about a dataset's tables.

## HTTP Request

```http
PATCH /api/v1/workflows/:workflowReference/dataSources/:dataSourceReference
```

## Path parameters

| Parameter           |                                                                                                                                                               |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| workflowReference   | A qualified reference to the workflow. See [referencing resources](/api/referencing-resources.md) for more information.                                       |
| dataSourceReference | <p>A qualified reference to the dataSource's current source dataset or workflow.<br><br>Alternatively, can provide the <code>id</code> of the dataSource.</p> |

{% hint style="info" %}
This endpoint extends the [general API structure](/api/rest-api/general-structure.md)
{% endhint %}

## Request body

Provide a JSON object with information about the dataSource.

<table><thead><tr><th width="206.20703125">Property name</th><th width="153.40755208333331">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>sourceDataset</strong></td><td><strong>string</strong></td><td><p>A qualified reference to the (new) source dataset for this dataSource. </p><p></p><p>Include version / sample information in the reference to update a dataSource's version or sample status.</p><p></p><p>Either a sourceDataset or sourceWorkflow must be provided, but not both.</p></td></tr><tr><td><strong>sourceWorkflow</strong></td><td><strong>string</strong></td><td><p>A qualified reference to the (new) source workflow for this dataSource. </p><p></p><p>Either a sourceDataset or sourceWorkflow must be provided, but not both.</p></td></tr><tr><td><strong>mappedTables</strong></td><td><strong>object</strong></td><td><p>An object whose keys represent the current tables that are referenced on the dataSource, and whose values represent the corresponding tables in the new source dataset or workflow. E.g.,</p><pre><code># Reference id suffixes are optional, but take precedence over names
{ "old_table:xje9": "new_table:a842" }
</code></pre><p>In many circumstances, tables can be automatically mapped based on their name and identifier, and this parameter isn't needed. <br><br>However, if a previously-referenced table doesn't exist under the new data source – e.g., a table is deleted in subsequent versions – you'll need to provide information so that any downstream notebooks or transforms can be updates.<br><br>It is only necessary to map tables that are referenced by a downstream node, not all tables associated with the dataSource.</p></td></tr></tbody></table>

## Authorization

Edit access to the corresponding workflow is required. Your access token must have the following scope:

* workflow\.write

[Learn more about authorization.](/api/rest-api/authorization.md)

## Response body

Returns the JSON-encoded "get" representation of a [dataSource resource](/api/resource-definitions/datasource.md).


---

# 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.redivis.com/api/rest-api/datasources/patch.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.
