Yes please to this!!! --> It’d be ideal if the API for each base conformed to something like Swagger 2.0
Hey Tristan,
I know this is a really late reply…
But in any case you can construct the “schmea” dynamically with the help of the Airtable API and some native language like PHP, JAVA etc…
Zapier does it as it dynamically picks up all your fields and bases when you create a Zap for Airtable
After logging in to the Airtable website I’ve been pasting the following into the browser console of the API documentation page. I then paste the result into a new json text file. I haven’t bothered with automating or finding a better way.
console.log(JSON.stringify(_.mapValues(application.tablesById, table => _.set(
_.omit(table, l'sampleRows']),
'columns',
_.map(table.columns, item => _.set(item, 'foreignTable', _.get(item, 'foreignTable.id')))
))))
Hey Tristan,
I know this is a really late reply…
But in any case you can construct the “schmea” dynamically with the help of the Airtable API and some native language like PHP, JAVA etc…
Zapier does it as it dynamically picks up all your fields and bases when you create a Zap for Airtable
@Andrew_Johnson1, how are you retrieving the Schema via the API? All the programmatic solutions I’ve seen in this forum appear to be doing something like scraping the API documentation page. If you have any code (in any language) I’d love to see it!
Thanks in advance.
-Mark
Yes, please. The ability to download a Swagger definition for a base schema is somewhat critical for using the API in either language suites (e.g. .NET) or from low code platforms.
Since I was interested in this myself and such an API still does not exist I created an addon that scrapes Airtable documentation pages for the schema definition and converts it into an OAS 3.0 API definition. I can’t post a link directly to the addon page but you should be able to find it in the Mozilla addons site by searching for “airtable swagger”.
If you experience any trouble with it you can write an issue in github. It probably won’t handle all cases of Airtable schemas but I think the output is a mostly-complete description of the API.
After logging in to the Airtable website I’ve been pasting the following into the browser console of the API documentation page. I then paste the result into a new json text file. I haven’t bothered with automating or finding a better way.
console.log(JSON.stringify(_.mapValues(application.tablesById, table => _.set(
_.omit(table, l'sampleRows']),
'columns',
_.map(table.columns, item => _.set(item, 'foreignTable', _.get(item, 'foreignTable.id')))
))))
I used your console code in early October and it worked perfectly to create a JSON enumeration of the tables and fields. I rejoiced and continued working my own code to the point where I could use this. Now, 2 weeks later, your console code only gets the response “ReferenceError: _ is not defined”. Methinks Airtable has changed their JS just enough to break your scheme, maybe deliberately to thwart enumeration.
It is 2024 -- seven (7) YEARS later and Airtable has YET to rollout an API endpoint to allow users to change an existing table schema? This is nuts!