Last active
December 12, 2020 21:34
-
-
Save douglaslassance/0ba26f2cf2aa9bb21a521ba07d751244 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Go to https://airtable.com/api and select a base. | |
// Then open your browsers console (Ctrl+Alt+I) and run the following code. | |
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); |
My bad, I wasn't running it while looking at the API docs but when I was viewing the base. It works great!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code no longer seems to work since
window.application
is undefined?