Certain files are not returned by the Coda API

Hi folks!

TLDR: A user of my search integration product is experiencing issues with the Coda API not returning all documents when using the /docs endpoint, despite the documents being accessible and editable by anyone in the workspace.

I am using the Coda API for my search integration product. I am primarily using the “List available docs” endpoint to fetch documents based on a search term. A user of my product is encountering an issue with the API where not all their documents are returned when calling the /docs endpoint. To ensure the issue was not with the API token, we ran tests in the browser using the URL https://coda.io/apis/v1/docs, as this does not require an API token and only requires the user to be logged into their Coda dashboard. We then conducted the following tests:

  1. The user created a document named “Testing Coda API” in a private folder. When calling the API https://coda.io/apis/v1/docs?query=testing in the browser, the API did not return any results even though the user created the document.
  2. The user created the same document in a public folder that was accessible to anyone in the workspace, but calling the same API in the browser still did not return any results.
  3. Finally, the user created the same document in their “My docs” folder, and the API was able to return the new document. This was the only test that passed.

Overall, the Coda API was able to return some documents that matched the search term, but it did not return the specific documents the user was looking for. We verified that the files were accessible by anyone in the workspace. The user did not originally create many of the folders, but was able to access them on the Coda platform.

What could cause the Coda API to behave this way? The user has no issues when using the native Coda search in the dashboard, but the API behaves differently. Is there a global admin setting that would prevent the Coda API from returning certain folders and/or files?

Hi @Oscar_Castro - Thanks for the detailed information about what you tried. I just did the same test on my own accounts, and the API was able to bring back docs in all three types of folders. A few possible things you could check for:

  1. When creating the test docs, make sure that the doc title is being set. The heading on the fist page is copied to the page title, but only once you edit the field and only the first time you edit it. The query parameter can only be used to search over doc titles currently, not their content.

  2. Check to make sure that there aren’t additional pages of results returned by the API. For a common term like “testing” the user may have more results that can be returned in a single page.

2 Likes

Hi @Eric_Koleda, I appreciate the quick response and the screenshots! So it turns out that the issue was not with the /docs endpoint. As a new user to Coda, I didn’t realize that within folders, you have docs, and within docs, you have pages. The user was searching for a page within a doc but couldn’t access it using the /docs endpoint since the doc had a different name.

For example, the doc was named “Coda Doc,” which contains a page named “Testing.” When he called https://coda.io/apis/v1/docs?query=testing, the API didn’t return any results since there are no docs that contain that term, only pages. The only way to get that page via the API is to call the /pages endpoint using the docId of “Coda Doc”.

My question now is, how can I get the docId to call the /pages endpoint if the request to the /docs endpoint does not return any data? The user would have to know the doc name beforehand, query that name using the /docs endpoint, and then get the docId to call the /pages endpoint. Is there an easier way to do this? I am thinking of an endpoint that lets you query just the page, something like /pages?query={:term} .

Thanks!

Hi @Oscar_Castro - Unfortunately the search capabilities of the API are fairly limited at the moment. You can search for a doc by name, but you can’t query based on the contents of the documents. The Coda UI has a more advanced search feature, but we haven’t yet brought that to the API.

I’m not sure if querying over all pages is even feasible, but even if it was I don’t think we’ll be able to implement that in the short term. The pattern we’ve seen implemented in other integrations is to first have the user locate the doc (browser or search) and then locate the page within the doc (browse or filter). It does require that the user know which doc their page is within, but that’s fairly fundamental to using Coda overall.