Jun 09, 2020 01:57 PM
Is it possible to pull all the “Views” of a given table via the API? I don’t mean specify a particular view as part of an API call, but rather, I want to pull ALL the views of a given table as its own list.
The table object doesn’t seem to have a views object anywhere that I can find:
1. destroy: (...)
2. fetch: (...)
3. fields: (...)
4. id: (...)
5. patchUpdate: (...)
6. putUpdate: (...)
7. replaceFields: (...)
8. save: (...)
9. updateFields: (...)
10. _rawJson: (...)
11. _table: (...)
Jun 09, 2020 04:54 PM
If you’re using the regular API or Airtable.js, this isn’t possible.
If you’re building a custom block that will run inside Airtable, you can access table.views.
Jun 09, 2020 05:16 PM
Thanks @Kasra This is a VueJS app and my airtableClient for retrieving table records is below. Can I do something similar to retrieve a views object of a given table that contains the views id, name, record ids, etc. of that view?
getTable(table) {
let recordsArr = [];
const base = new Airtable({ apiKey: environment.API_KEY }).base(
environment.AIR_TABLE_BASE_ID
);
base(`${table}`)
.select({
maxRecords: 8000,
})
.eachPage(
function page(records, fetchNextPage) {
records.forEach(function (record) {
recordsArr.push(record);
});
fetchNextPage();
},
function done(err) {
if (err) {
this.$toasted.error(err);
}
}
);
return recordsArr;
},