Filtering table records via link field in REST API

I have a need to retrieve a subset of records from a table via the REST API (GET method for table records). That API allows for a ‘filters’ parameter but I’ve been unable to use it with a record link field. I’ve tried formats that make sense to me but am hoping that I’m just overlooking some combination that will work.

As an example, lets say I have a field wxyz_link_left_column in the table that I’m filtering on. The records that I’m interested in retrieving all have the same “parent” with an ID of “12345”. I have tried each of the following filter parameters:

  • filters=[{“field”:“wxyz_link_left_column”,“functionType”:“equal”,“arg”:“12345”}]
  • filters=[{“field”:“wxyz_link_left_column”,“functionType”:“equal”,“arg”:"[“12345”]"}]
  • filters=[{“field”:“wxyz_link_left_column”,“functionType”:“contains”,“arg”:“12345”}]

All result in server errors. Is it possible to filter using the record link field of a table? If not, I assume that I’ll have to replicate the parent ID in a simple text column and use that. Not sure what a record link is offering for app development or integrations.

I just noticed when I reread the post that the HTML is obscuring part of the formating in the second example. The quote within the array bracket is being escaped with a backslash () to try to preserve it during transmission.

Hi Lance,

We are planning some improvements to our filter functionality that will make this less cumbersome.

For the time being, a workaround that should accomplish what you want is to first fetch the record “12345” (the parent), then read it’s link column values (which will have some list of ids [“childId1”…]).

You can then use a filter like:

filters=[{“field”: “id”, “functionType”: “isIn”, “arg”: [LIST OF IDS]}]

1 Like

@ytadmor - thanks that did the trick! Very useful. The “isIn” functionType is not in the API documentation but worked as advertised.

1 Like

thanks for flagging this @Lance, we’ll be updating our API documentation to include this filter.

thanks again!!

Those fixes to the documentation should be included in our next release :slight_smile:

1 Like