Python requests : filter rows on table-type field

Hi !
I succesfuly managed to query rows from my table using your python documentation (which is great, thanks)
Now, I’m trying to filter these rows using the filter__{field}__{filter} params key. It works on single ligne type fields but I did not succed with the link-to-table type. Does it require a different syntax ?
This is the code I used, the Client field is a link-to-table type:

response = requests.get(
        "Authorization": f"Token {token}"
        "filter__Clients__equal" : "Mister XX"

Hey there :slight_smile:

Great to see that you are using our API!

So as you already probably figured, the syntax for the param is filter_<name-of-the-field>_<name-of-the-filter> and in this case you are trying to filter over Clients with an equal filter.
Clients is a link to table field and the reason why it doesn’t work is because link to table fields don’t have an equal filter.

The options you have are:

  • link_row_has
  • link_row_has_not
  • link_row_contains
  • link_row_not_contains
  • empty
  • not_empty

If you are ever unsure what types of filters your field supports you can look at the API documentation (REST API documentation // Baserow) under <your-database-name>fields you can see a list of available filters for each field that you have in that database:

Screenshot 2022-08-08 at 09.03.06

Hope that helps!


Thanks for your answer Alex.
I tried the link_row_contains method instead, but the result is still un-filtered.

response = requests.get(
        "Authorization": f"Token {token}"
        "filter__Clients__link_row_contains" : "XX"

Hey there,

Interesting! Maybe you can double check the name of your field and look out for any spelling mistakes?

I have prepared a demo for you to showcase that this should be possible:
A public grid view I created: Baserow // Baserow

The request which will filter the link row value:

1 Like

Hi @Alex,

Ok then… without the User Field Names syntax it totally works.

response = requests.get(
        "Authorization": f"Token {token}"
        "filter__field_543116__link_row_contains" : "Mister XX"

I wish I could avoid that for code clarity but it is not a big deal.
Thank you !

Hey @Nicolas,

Hmm so you are saying that user_field_names are working fine on text fields but they are not working on link row fields?

If that is the case then this might actually be a bug worth investigating.

Hey @Nicolas ,

Me again :smiley:

Just had a talk to the other devs, it looks like this isn’t part of what user_field_names is supposed to do. At the moment this flags only influences the response, so all the field ids are swapped by their names in the response. This does not mean that you can use the names in the filters as well instead of the ids if you set the flag.

I am curious to understand why this worked for you on the text field? It shouldn’t have, are you sure you used the name? Could you maybe provide a public url that does exactly that and it works?

No worries if it was just a mixup!

I’ll be glad to help you with another example. How do you create a public link ?

@Nicolas I made you a little gif that shows how to create a public view :slight_smile:

can’t believe you made that gif just for me :smile:
There you go :

Great! What I meant is, I don’t think you can ever filter in the url using user field names, regardless of what field type, this just doesn’t work in general.

This does not work:

This does work:

You’re right.
Ok, now I know how to handle the filter.
thanks for your help.