Help

Re: How to start with the API?

2976 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Michel_Billiau
6 - Interface Innovator
6 - Interface Innovator

Hello everyone,
Sometimes I feel the need to print my Airtable table records physically on paper (A4, A5 or even A6), while controlling every formatting and styling aspect (i.e; multiple records on 1 page, formatted as a table X by Y, or a list, controlling the font attributes, the border attributes, rounded corners, background colours,…).
Printing possibilities by default in Airtable are a little to basic. I’m on the Airtable free plan, but even the Page Designer App won’t stretch that far, I guess…

So I think the only way to get it exactly as I want is, is to go through the API, extract the records I need and position them and style them.
But how do I start with the API ? Which tools do I really need ? I read something about airtable.js and also node.js and npm…all very new to me. I’m not afraid to dive in new technology, but I need a starting point. My data in Airtable is mainly personal inventory, like movies, books, games,… There is no need to build a public website, it is only for my personal use.
Anyone who has tried this before and can point me out how to start ?
Many thanks…

PS For a good understanding, before I started to use Airtable, I used raw XML files as my data container, then I transformed it with XSLT in to HTML, and with the proper CSS I was able to print it exactly as I wanted it.
I could use the JSON files form Airtable, convert it to XML and continu from there as before, but I don’t think this is the right way. If I want to change this setup I want to do it with the contemporary tools out there in the market and leaving out XML and XSLT.

16 Replies 16
M_k
11 - Venus
11 - Venus

Hi @Michel_Billiau

I found this link in the community, although, it seems to be current, I would wait to see what others might post.

How this helps.

Mary Kay

Here is another link, I don’t know if this addresses your use case, but I thought I would throw it into the mix.

Here is another link, about Airtable API, see if this is what you are looking for.

The article mentions using Postman (use for testing) , you can find more info on YouTube.

Thank you Mary Kay for this quick response !
While waiting for other ideas, I’ll start taking a look a Postman…

I would read this as a start. And then take a look at this.

Yes, you could, and that’s not a bad approach except that JSON doesn’t always transform well into XML. I recommend you set the bar a little higher and learn how to transform JSON into HTML/CSS. Your life will be much happier and you’ll be able to leave the less-efficient world of XSLT in the past. I made the same journey and I do not regret the weeks of learning to escape from XSLT.

Yep, these are relatively complex environments to master. I recommend new API programmers take a look at using Google Apps Script for example, this post.

If you want to pursue a no-code solution, take a look at miniExtensions.

Thank you Bill for so much information !
I fully agree with you for leaving XML & XSLT behind; although good structure and possibilities, they are technologies from the previous century…

Indeed. I was in attendance at XML’99; I am that old. :winking_face:

I think using the rest API for occasional printing is overkill unless you really like coding or need a simple method for other people without access to the base.

For the personal one-off print job, I usually find copy/pasting into Word or Excel, then doing my formatting in Word/Excel to be fairly quick.

For tables that I know I will want to print again with fancy formatting, saving to CSV followed by a mail merge in Word can work well, depending on the type of data.

Since you already have the proper CSS, how about using Scripting app to generate the HTML and use the same CSS?

  1. Setup your view to include the records you want.

  2. Run the custom script to generate the html and save the html in a long text field of a table created for that purpose.

  3. Copy/paste the html to a text file with the .html extension.

  4. Open in your browser and print.

If you want to get a bit fancier, send the html to a service that converts html to pdf. But personal one-off printing usually doesn’t need that much automation.

Airtable Scripting is much easier to learn and use than the rest api. Install the Scripting block and poke around the examples and the documentation. The documentation is quite good.

Thank you Kuovonne for these suggestions…
You are absolutely right that using the API for printing purposes is overkill, but that is price I want to pay for have robust solutions and full control. Maybe I regret this overtime :winking_face:
In the past, I tried with conditional formatting in Excel and my experience is that you can have a very quick and easy solution, but it is never what you really want, like rounded corners around the cells, background colours, thumbnails, multicolumn, different page sizes, etc …
Furthermore, the source (i.e. Excel) is still “encrypted” if you compare this to a text readable format.

I like more the idea of scripting, and requires also a bit of coding, but the script block is only available for the free plan until March… so I might lose functionality within a few months, unless I upgrade.

If you are printing from the same bases, you can also generate your html for free using formula and rollup fields. It isn’t as robust and flexible as an api solution, but might be easier to code.

But if you want to use the API, by all means, go ahead and learn it. Airtable’s documentation for the API is very good and a great starting point.

Eric_Goldman1
7 - App Architect
7 - App Architect

Hey @Michel_Billiau,

@kuovonne’s guidance here is great - the API could be a bit of a lift depending on how many records you are dealing with and how you need to filter.

One easy solution could be to pull your data into a tool that makes formatting and visualizing the data easy and printable → like excel or google sheets. The downside is this is relatively manual as the data changes.

Or, you could use a more robust tool like Google Data Studio where you can format and build dynamically. We just built a new tool, Sync Inc, that will allow you to sync your data to a Postgres database that you can then natively connect to GDS.

Then you can make PDFs and print to your hearts content. And this should all be completely free for you.

If this sounds like an interesting path, you can check out Sync Inc to get started → https://syncinc.so/

A pro workspace is $20/month or $240 per year. That is a lot of money for some people, especially people with more time than money. On the other hand, sometimes time is money. If you like robust code-based solutions with full control, it might be worth the $240 for the time that you would save in development of both this and other projects. Also, keep in mind that Airtable already extended the deadline for when scripting would become paid once, and they might do it again. (It originally was going to expire back in September, but was pushed out to March.)

You could also try for a Creator Plan as mentioned here and here. I don’t know if this plan exists anymore or if is is possible to request at all, but it provided pro benefits to a workspace with a single collaborator.

I’m not sure if the financial outcome is any better, but this post is somewhat relevant to @Eric_Goldman’s comments. I hadn’t considered some of the advantages to using a SQL [following] database until over in that thread, but I suspect Syn Inc might have a free tier making it possible to avoid the scripting block while shaping your data for pretty advanced reporting and all without relearning a lifetime of XSLT. :winking_face:

Michel_Billiau
6 - Interface Innovator
6 - Interface Innovator

Thank you Eric, Bill for your thoughts on other relational db’s, that might have a better backbone structure for making reports (if I may summarise these thoughts like this).
This might be a solution for sure, but personally, as I’m very happy with Airtable storage for data today, and JSON is the format it supports through the API, on first thoughts, it sounds a bit overkill to bring the data over to a SQL db, only for better formatting and printing.
But as I’m eager to learn, I’ll certainly take a look at this approach :winking_face:

Yes, this seems a bit like turning off a light switch with a wrecking ball, but thinking it through I have these observations.

  • This approach requires only a one-time configuration; the data just flows there all the time; think of it as a plugin that enhances the primary Airtable datastore.
  • Airtable has no ability to perform ad-hoc queries that span the relational model created through linking. A “following” SQL database would make this possible and helpful from time-to-time when you need something special.
  • The Airtable API doesn’t magically create data extracts that are relational consistent with the relationships you’ve created in the Airtable UI. To create any sort of API process that must factor in the relational model, you have to build it from scratch for every API process. This is a non-trivial effort and depending on the relational aspects of your data, it can be a complex and sizeable effort in script.

Hey @Eric_Goldman, @Bill.French
As I said before I’m eager to learn new things :grinning_face_with_big_eyes: so I gave this a shot.

  1. Setting up an PostgreSQL db through Sync Inc (free account) works great ! Done !
  2. Connecting with GDS works very intuitive ! Done !
  3. Creating my first report … now there is a learning curve. This will need some time to master these skills
    not only in creating the reports I want, but also in printing them (remember this was my first concern)

I have to make a trade off between going further in this direction versus the effort of setting up a JS framework, working with the API, and create the report manually.

Thank you both for sharing your thoughts and opening my eyes in that direction.

CH3V4L13R
5 - Automation Enthusiast
5 - Automation Enthusiast

Hey @Michel_Billiau
Any chance PDF MONKEY works for you maybe? Using Integromat you can connect Airtable and Pdf Monkey to generate your data in PDF and style them as you want.

Hi @Michel_Billiau

I was going to mention Integromat too. It’s a great app and it helps to automate your process.

Mary Kay