Help

Metadata API for schema and mutating tables

Topic Labels: API
27168 40
cancel
Showing results for 
Search instead for 
Did you mean: 
Simon_Horup_Es1
6 - Interface Innovator
6 - Interface Innovator

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 :slightly_smiling_face:

40 Replies 40
Tuur
10 - Mercury
10 - Mercury

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

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.

mattlibera
4 - Data Explorer
4 - Data Explorer

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

As of last week: months…

mattlibera
4 - Data Explorer
4 - Data Explorer

:disappointed:

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

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);
tom_m
4 - Data Explorer
4 - Data Explorer

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

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

Kai_Curry
5 - Automation Enthusiast
5 - Automation Enthusiast

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

Unfortunately that’s not good enough for me.