API: How to query for a relation?

I might sound stupid here but I’m really not finding a good way to filter my query based on relations.

I am successfully pulling data via the API and I found the query parameter works fine for searches but how would I reliably filter for a relation ideally based on rowId of the relation?

In this example my Project column has a relation to the Project table and each of the entries I’m querying from the table is related to some Project. I’m using valueFormat=rich to get the raw data and I see the relations in the Result but looking at API docs I’m not able to figure out a way to reliably filter for it.

I guess it does need to be a query but I can’t seem to use Project.rowId:"whatevertheidis" or any similar syntax. I feel a bit stupid because this sounds so basic but I can’t find anything about it. Not in the starter guides and not anywhere else.

Just point me to the point where i overlooked the info please :blush:

Cheers,
Helmi

Hi @Helmi - Don’t feel stupid, you didn’t miss anything! We unfortunately don’t support that feature, even though as you admit it’s pretty basic. At the moment you can only query on the plain text value of cell, and I believe that only works when the value format in plainText.

I’ve been pushing the API team to support a more robust query language, but there are a lot of other competing priorities and it hasn’t made the cut just yet. I’ll pass along your request as another data point, but I wouldn’t expect any changes in the near term. For now the best you can do is fetch the full contents of the table and do the filtering in your code.

2 Likes

Oh that’s really unfortunate, but good to know.

I hope we can get a more robust solution in the future. For me coda would be a great solution to have a good document based UI to manage data that can then be used as a backend for different applications. But a bit more robust query options would then really be helpful.

The more concerning question then though… can I write relations with new entries to the table as I’m not even able to filter them? How would I do that?

can then be used as a backend for different applications.

I’d caution that Coda’s API is meant to support integrations with Coda, but the features and rate limits aren’t really geared towards using it as a backend for an application.

can I write relations with new entries to the table

The upsertRows endpoint allows you to change the value of a cell in a Relation column. You can either pass the display value of the target row, but a more accurate method is to pass the row ID.

1 Like

Thanks, Eric.

Oh, I’m definitely aware of the limitations and the rate limits. That’s just fine. I’m currently working on a web app that creates more or less static content that is pulled from Coda. So API access will be very limited to generation cycles. The thing is that Coda just offers good and easy access to working on the content with a team without needing to craft an admin backend. That’s very valuable for a small team like ours.

thanks, will definitely go for the rowId here.

1 Like