Write modes

When you run a request, the API response data is transformed from its original format (JSON/XML/CSV) into tabular data (records and fields) and written to your output table.

The tabular data can be written to your output table in two different ways, determined by the Write Mode:

  • Append - Add the records to the output table as new records.

  • Update - Update existing records in the output table, (optionally) create leftover records and (optionally) delete records not found in response.

There are more details and examples of the two write modes below.

Set the write mode

  • Under Write Mode, select the write mode you want to use.

Append Write Mode

The Append write mode simply adds new records to your output table. None of the existing records in your output table will be modified. This write mode is useful when you want to pull in new data at set time intervals and add it to your existing data.

Let's say the existing data in our output view in Airtable is:

Item IdItem nameUnits sold

229

Orange Hat

5

107

Purple Skirt

10

And the API response data (after being transformed from JSON) is:

Item IdItem nameUnits sold

692

Blue T-Shirt

7

229

Orange Hat

10

107

Purple Skirt

17

After a run with the write mode set to Append, the output view will be:

Item IdItem nameUnits sold

229

Orange Hat

5

107

Purple Skirt

10

692

Blue T-Shirt

7

229

Orange Hat

10

107

Purple Skirt

17

We could run this request every day, add a 'Created time' field in Airtable, and look at how the "Units sold" field for a particular item changes over time.

Update Write Mode

The Update write mode first updates the existing records in the output view.

If there are more records in the response than in the output view, the leftover records will be created as new records in the output table. You can also turn this behaviour off.

Using the same example values from the Append example above, let's say the existing data in our output view in Airtable is:

Item IdItem nameUnits sold

229

Orange Hat

5

107

Purple Skirt

10

And the API response data is:

Item IdItem nameUnits sold

692

Blue T-Shirt

7

229

Orange Hat

10

107

Purple Skirt

17

After a run with the write mode set to Update, the output view will be:

Item IdItem nameUnits sold

692

Blue T-Shirt

7

229

Orange Hat

10

107

Purple Skirt

17

The first two records were updated with the first two records in the response. Then a record was created for the third record in the response.

There is a problem in this scenario. Before we ran the request, the first record in our output view was associated with the 'Orange Hat' item. Now it's being used for 'Blue T-Shirt' and a different record is associated with 'Orange Hat'.

If we had linked other records to this record, added comments or values in other fields, these will now be associated with the wrong item.

We can avoid this by setting the Update Based on Field(s) to 'Item Id', a unique field that Data Fetcher can use to match the items in the response to those in the output view.

After a run with the Update Based on Field(s) set to 'Item Id', the output view will be:

Item IdItem nameUnits sold

229

Orange Hat

10

107

Purple Skirt

17

692

Blue T-Shirt

7

Data Fetcher will only look at the records in your output view, not the entire output table. So if you have filters applied to this view that prevent it from finding a matching record, a duplicate record will be created. To avoid this, use an output view that has no Airtable filters applied.

Create records leftover after update

By default, when the write mode is Update, leftover records will be created as new records in the output view. To toggle this behaviour on or off:

  • Under Write Mode, toggle "Create records leftover after update" on or off. This option is only available when the write mode is Update.

Delete records not found in the API response

You can tell Data Fetcher to delete any records in the output view that are not found in the API response. This is useful when you want to delete records in Airtable for items that were deleted in the third-party application and so are not found in the response.

  • Under Write Mode, toggle "Delete records not found in the API response" on or off. This option is only available when the write mode is Update.

Data Fetcher will only look at and delete the records in your output view, not the entire output table. Select an output view with no Airtable filters to ensure it deletes all the records in the output table not found in the API response.

Last updated