Metadata API for schema and mutating tables


#1

Is there any plan for an API to pull metadata? It’s currently very difficult to infer the schema, you have to resort to hacks like reading all records and then trying to infer types and column names from that. It’d be great if you could pull the schema information for a table more easily!

It’d also be awesome if you’d be able to add and change tables from the API, but that’s less pressing to me :slight_smile:


Accessing table's model via API
#2

+1. Apparently they’re working on it… :slight_smile:

Note that the Standard API does not provide the ability to create or modify base schemas. For this type of behavior, you will need to use the Airtable Metadata API, which has not yet been released.


Computed Fields on Update
#3

Anyone have any idea whether the Metadata API is getting close… ?


#4

As of last week: months…


How to retrieve table column metadata?
#5

:disappointed:

Oh well. Guess I’ll stick with hard-coding for now… thx.


#6

I found a half-way solution that will help in some use-cases while waiting for the metadata API.

Visit https://airtable.com/api and select a base. Then open your browsers console (Developer Tools) and run the following (I tried simply running JSON.stringify(window.application), however there are circular references so I had to manually reconstruct the properties I wanted).

var myapp = {
	id:window.application.id,
	name:window.application.name,
	tables:[]
};

for (let table of window.application.tables){

	var mytable = {
			id:table.id,
			isEmpty:table.isEmpty,
			name:table.name,
			nameForUrl:table.nameForUrl,
			primaryColumnName:table.primaryColumnName,
			columns:[]
	};

	for (let column of table.columns){
		var mycolumn = {
			id:column.id,
			name:column.name,
			type:column.type,
			typeOptions:column.typeOptions
		};

		mytable.columns.push(mycolumn);

	}

	myapp.tables.push(mytable);

}

jQuery('link[rel=stylesheet]').remove();
jQuery("body").html(JSON.stringify(myapp));
console.log(myapp);

Python script to retrieve schema from an Airtable base
Can we get a list of field definitions of a table?
#7

+1, getting the schema would be really great! Modifying the schema is far less important for our use-cases.


#9

Any news on this guys? Or are you keeping it exclusive to Zapier et al?


#10

Similar to the @Chester_McLaughlin solution above I created a node script that launches a browser environment and downloads the schema to a json file. https://github.com/cape-io/airtable-schema


#11

Unfortunately that’s not good enough for me.


#12

I feel your hurt Tuur - between

  • the lack of a metadata API
  • the inability to list all bases accessible with a given API key (hmm Zapier can do it, why can’t we? What endpoint have they been granted access to that we haven’t?)
  • the inconsistent way that fields are returned (empty values are sometimes just missing, other times empty arrays)

developers will struggle to write useful, reusable tools. The silence on this front is frustrating. If a small % of the effort going into front end tools like Blocks was put into these small enhancements, the sky is the limit.


#13

I’m afraid the silence (and removing of old references) is telling…

They probably have other priorities.


#14

I’d love to see a Metadata API as well…


#15

Why would it take so long? They use something automated to generate the table’s API documentation (I doubt there’s a poor intern building each table model for each table’s API docs…).

I’m sure all they’d have to do is expose it as an API endpoint that we can read.