API get doc as text/html/markdown

For the life of me cannot figure out how to get the content of a doc.

I can get tables rows in a doc and update a row, but I cannot get the text, markdown, or html version of a complete doc or section.

I cannot even find this in the api docs, so it may not be possible. On the other hand, get_doc would seem to be the most basic API call that should be one of the first to be implemented.

Am I missing something here or does coda really not support getting a doc via API?

6 Likes

Hi @Andreas_Huttenrauch, welcome to the community! Currently the API does not support retrieving text or markdown written in the sections. Only the metadata about the doc and sections are available. I’ll log your request for this with our product team!

1 Like

Is there any chance this is coming? This was the main reason I was going to use Coda (use the API to get my markdown content I write) and realized after putting some time into getting the content pulling with the API that there’s no markdown.

We don’t have a specific timeline on when this feature will get released. In the meantime, what others have done is store their data in tables in Coda so that they can retrieve the data using the API.

Hi y’all… would like to third a request for api access to the non-table page content and comments please. We have the following projects that we would like to use it for…

  • Internal CMS front end for our staff to write website content
  • Customer knowledge base back end for our staff to write up articles
  • Service delivery catalog
  • Customer proposals and agreements
  • HR employee file back end
  • Project meeting notes
  • Project workspaces

… and a few more…

But only being able to use the tables is tying a hand behind our backs and is the reason we haven’t fully embraced coda… if we had this final piece of the puzzle we would purchase a team licence for all of our employees immediately.

But when inspecting the page to see if we could scrape the page content from html, it appears to have been designed to prevent that with custom div tags and custom css :slightly_frowning_face:

4 Likes

Please add this ability. I’ve long dreamed of using Coda as a CMS for so many things. Support documentation, internal policy, long form… Coda is so much better than Google Docs. I’d love to use that power to integrate into a host of applications.

2 Likes

+1
I was about to jump on the Coda train, but due to the lack of grabbing text via API (also looking at Coda as CMS), I’ll likely use Notion or something else.

The one flag with using coda as a CMS is that API calls aren’t super fast in my experience. You may want to build a caching layer to improve page load speeds rather than querying coda on every visit.

But, I’m all for API access so +1 for section body API access :slight_smile:

Yeah, this is a shortcoming - all objects including text/paragraphs should be first-class citizens in the API. Until that happens, here’s how I do it.

  1. Every hour send the [needed] page content of a document to a role account (like codapi@yourdomain.com) using the Gmail Pack.

  2. Parse the email using Google Apps Script and push it into Firestore.

  3. Create a simple API for your Firestore database in Google Apps Script or Firebase functions that expose the latest content.

Ugly, latent, a fair bit of work and Goldbergian for sure, but it gets the job done.

I have not explored how the new Packs Studio might be able to address this if at all.I don’t think it has methods to read the document content directly. However, that doesn’t seem to make sense because the Gmail Pack is able to send a page from a Coda doc. This is presently a mystery because such Pack-level capability doesn’t seem to exist in the Packs SDK.

@Coty_Beasley I’m playing around with ways to implement a Coda CMS too.

As @Bill_French described, you can get the content via the Gmail pack. But behind the gmail pack is a simple formula called “tohtml()” that transforms the page to a html string directly in Coda. You can use a button and this formula to fill a cell with the contents of a page in HTML, and then read the table via the API.

Kudos to @Paul_Danyliuk for introducing this to me.

In my tests I had to choose the page within the formula manually with autocomplete and was not able to bring it in dynamically e.g. from a table of pages. Maybe it is possible with black magic somehow. If you have a fixed number of pages, you can set that up once anyway.

Example:
Bildschirmfoto 2021-10-22 um 10.10.51

1 Like

With black magic I’d imagine this workflow. Full page IDs (canvas-xxxxxxxxxx) are available through Coda API. So Zapier/Integromat/API etc can first insert a canvas ID into a cell, then we could have a reconstructed button that would render that particular canvas into HTML into a cell (with API we can click buttons), and then we could grab the text at that button.

There may be race conditions though, i.e. the doc wouldn’t recalculate with the new canvas ID and the button click wouldn’t render the proper page. You could potentially avoid this by:

  • have the API call insert a row into some “export requests” table
  • have Coda automation watch on new rows, and insert HTML into a column of that newly created row
  • have another zap / polling API watch over that freshly rendered HTMLs and react independently on each row.

I’ve tried it with duplicate Page and use the result object in toHTML, but the result of the duplicate page seems to be just a hyperlink object with the browserlink. So for tohtml you’d need the real canvas id?

If it is possible with API, then it will at least be possible with packs then, without the whole zapping around

I also wanted to export the text from all the pages of a document.
So I have build this document below.

When a page has been edited, I press the Save Page! button at the end of the page and it populates a table with the pages content.

So I end up with a table containing all the pages titles, icons, HTML, and the tab-indented text content.

Then I can export that table with the API or via Corss-Doc.

Not the solution we are looking for - but its workable work-around for now.

Max

3 Likes

@Al_Chen_Coda is this still on the road map? It’s been a few years now and there still isn’t a way to get page content through the API? Major shortcoming and frustration being unable to access our Organizations data.

1 Like

This is becoming quite critical with the recent push in AI. Right now, there is no way to let AI access all of our Coda documentation because there is no API to retrieve the text. It’s a major issue that’s making me reconsider Coda as a whole, no one want to miss the AI train,

2 Likes

It’s hard to believe I first asked about this in 2020 sometime; maybe as far back as 2019. This is a key requirement and especially the case if building AI systems that leverage the primary texts that people need in their AI interactions.

1 Like

Which has got me looking at other options. Speed of data going into coda is 30s+ via api, and to not have this on top of the PCKE https for etsy, I just can’t wait anymore. mem.ai for 1!

1 Like

And this matters why [exactly]? Is your process so critical that new data arriving in a document is somehow compromised because it takes a half-minute to appear? If your workflow depends on real-time updates and awareness matters within 2 or 3 seconds, HTTP with a REST interface is not the right infrastructure; you need a sockets-layer solution. Mem doesn’t have that, and Mem has only one API POST method even after 3 years of development

I’m not following your comment. What [exactly] were you waiting for? I worked with Mem for an entire year and left the paid version because of so many poor architectural decisions and defocus from their core strength. What did I miss?

2 Likes

Like I said it just isn’t that, PKCE is also important and there’s multiple things that have been touted as being released soon or at least to be worked on that hasn’t been worked on for over 2 years at the end of the day, it’s been 2 years since basic things that have been asked for haven’t even seen the light of day. This is what I’m saying is far as not waiting anymore. There are things that have been asked for they’re just not here and with AI being able to build whatever you need people are not going to wait anymore.

And the fact that I can’t get data ie HTML or markdown into anything that’s being automated via API in 2023 doesn’t even make sense, I shouldn’t have to hack or patch my way into getting something that I put into a system directly.

1 Like

Thanks for the added clarification.

Fair points. All sorts of platforms are challenged with slow to unresponsive updates. Coda as it’s challenges as well. At Airtable I’ve been waiting since 2016 for a Split() formula. How is that even possible?

Yeah, there are some existential threats looming to many platforms because of AI. People’s jobs are not the only things on the chopping block. However, wholly replacing platform functionality and doing so with the security you require is still a bit of a stretch in most cases. Indeed, disruption can start small and rapidly reach a tipping point.

Fair complaint. I agree. I was hoping to get text from Coda’s canvas in 2019. The API doesn’t embrace text, so it remains a dead end and as a result, lost opportunities over many years.

But… how can you say Mem is one to lean into? There’s no API (just a mem POST); no ability to retrieve information, and not a single word about the possibility of a fully-baked API. Of all the companies that should have been in the GPT Plugins launch, the one funded by OpenAI had nothing to show. This is an indicator of no confidence. And like you said - who needs Mem when you can build a better Mem in a weekend?

3 Likes