Response data transformations
Data Fetcher transforms the response data from an API request to Airtable fields and records.
Data is mapped to the appropriate field type, e.g. numerical values are mapped to number fields.
JSON, XML & CSV API responses are currently supported. XML responses are first transformed to JSON using the xml2js npm package then follow the steps below.
There are two possible data transformations: Single Record or Expanded.
An example helps demonstrate the difference. If the API returns this response:
1
[
2
{
3
id: 'company1',
4
positions: [
5
{
6
id: 'position1',
7
},
8
{
9
id: 'position2',
10
},
11
],
12
},
13
{
14
id: 'company2',
15
positions: [
16
{
17
id: 'position3',
18
},
19
{
20
id: 'position4',
21
},
22
],
23
},
24
]
Copied!
  1. 1.
    Single Record - nested arrays are given their own fields, pre-fixed with a number. This ensures each parent entity is contained in a single record. The above response would be turned into:
1
.id .positions.1.id .positions.2.id
2
company1 position1 position2
3
company2 position3 position4
Copied!
  1. 1.
    Expanded - nested arrays create new records, sometimes duplicating the parent entity into multiple records. The response would be turned into:
1
.id .positions.id
2
company1 position1
3
company1 position2
4
company2 position3
5
company2 position4
Copied!

Set the data transformation mode

  • Click
    to open the advanced options.
  • Under Data Transformation, select the data transformation from the options.

Combine array items

When the Data Transformation is set to 'Single Record', Data Fetcher will by default combine arrays of strings/ numbers into a single comma-separated text value. e.g. this API response:
1
[
2
{
3
id: 'company1',
4
categories: [
5
'Fintech',
6
'Startup'
7
],
8
},
9
{
10
id: 'company2',
11
categories: [
12
'Healthtech',
13
'Public',
14
'Unicorn'
15
],
16
},
17
]
Copied!
Would become:
1
.id .categories
2
company1 Fintech,Startup
3
company2 Healthtech,Public,Unicorn
Copied!
Alternatively, you can turn this off so each array item is split into a new field:
1
.id .categories.1 .categories.2 .categories.3
2
company1 Fintech Startup
3
company2 Healthtech Public Unicorn
Copied!
To turn this on/ off:
  • Click
    to open the advanced settings.
  • Scroll down to Data Transformation.
  • Ensure Data Transformation is set to 'Single Record'.
  • Toggle Combine arrays of text/numbers into comma-separated text fields on or off.