Help

Fetch Airtable image url in a array in Javascript/NodeJS

Topic Labels: API
1515 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Michael_Harris
5 - Automation Enthusiast
5 - Automation Enthusiast

I was looking into the Airtable API, and I looked into the section “list records”, I can see the sample code in Javascript, and some of the fields I have looked into, it only works on the ‘text’ or string field type.

eachPage(function page(records, fetchNextPage) {
    records.forEach(function(record) {
        console.log('Retrieved', record.get('Name'));
    });

Then I tried adding the “profile photo” field, but knowing the field is actually a array type because there are separate URLS for different image sizes in a array. Simply what I did is this

eachPage(function page(records, fetchNextPage) {
    records.forEach(function(record) {
        console.log('Retrieved', record.get('Profile Photo'));
    });

I tested in a playcode.io playground and came out as this:

Retrieved (1) [{...}]
Retrieved (1) [{...}]
Retrieved (1) [{...}]

Is there a way to get a item in a array field in this? I just want to get the attachment/image url.

0 Replies 0