Help

Re: Issues with filtering based on array values via REST API

106 0
cancel
Showing results for 
Search instead for 
Did you mean: 
yoventures
4 - Data Explorer
4 - Data Explorer

I have an airtable that has the following data:

 

[
  {
    "id": 46,
    "createdTime": "2024-11-22T06:48:11.000Z",
    "Campaign": [
      "rec1OnuA36COKk2rC"
    ],
    "Status": "Posted",
    "Account": [
      "recFO8uEMB7wZaSYw"
    ],
    "External ID": "3914",
    "Created": "2024-11-22T06:48:11.000Z",
    "Last Modified": "2024-11-22T19:42:20.000Z"
  },
  {
    "id": 47,
    "createdTime": "2024-11-22T06:48:35.000Z",
    "Campaign": [
      "rec1OnuA36COKk2rC"
    ],
    "Status": "Posted",
    "Account": [
      "rec6lTjVaKUR6gSuQ"
    ],
    "External ID": "urn:li:share:7265617134745976832",
    "Created": "2024-11-22T06:48:35.000Z",
    "Last Modified": "2024-11-22T06:48:35.000Z"
  },
  {
    "id": 49,
    "createdTime": "2024-11-22T06:49:14.000Z",
    "Campaign": [
      "rec1OnuA36COKk2rC"
    ],
    "Status": "Posted",
    "Account": [
      "rech7SZ12yAqOSdmS"
    ],
    "External ID": "18114831709420263",
    "Created": "2024-11-22T06:49:14.000Z",
    "Last Modified": "2024-11-22T06:49:14.000Z"
  },
  {
    "id": 50,
    "createdTime": "2024-11-22T06:49:19.000Z",
    "Campaign": [
      "rec1OnuA36COKk2rC"
    ],
    "Status": "Posted",
    "Account": [
      "rec77IwfUeAt81lPG"
    ],
    "Created": "2024-11-22T06:49:19.000Z",
    "Last Modified": "2024-11-22T06:53:35.000Z"
  },
  {
    "id": 56,
    "createdTime": "2024-12-02T00:19:07.000Z",
    "Campaign": [
      "recuL1EP1AXaEeoy0"
    ],
    "Status": "Draft",
    "Account": [
      "recFO8uEMB7wZaSYw"
    ],
    "External ID": "3934",
    "Created": "2024-12-02T00:19:07.000Z",
    "Last Modified": "2024-12-02T00:19:07.000Z"
  },
  {
    "id": 48,
    "createdTime": "2024-11-22T06:48:52.000Z",
    "Campaign": [
      "rec1OnuA36COKk2rC"
    ],
    "Status": "Posted",
    "Account": [
      "recFWWXcFGwxwxSUV"
    ],
    "External ID": "504770633232868_1004975498313338",
    "Created": "2024-11-22T06:48:52.000Z",
    "Last Modified": "2024-11-22T06:48:52.000Z"
  }
]

 

I'm trying to call the REST API with the filterByFormula parameter that will return records that contain a "Campaign" value of recuL1EP1AXaEeoy0 (Which in this case should return one record, where id=56). based on the docs, I came up with the formula below:

 

FIND("recuL1EP1AXaEeoy0", ARRAYJOIN({Campaign}, ","))

 

this doesn't return any records though. and I'm not sure if this is an issue with my formula?

 

1 Reply 1

The value the REST API gives you for a linked record field is an array (list) of Airtable record IDs. However, when you use filterByFormula, you need to use an Airtable formula that would work in a formula field, and that requires used the primary field value for the record, not its internal record ID.