Blog post: https://medium.com/@benoror/creating-an-ember-addon-for-airtable-api-d9e38d7bef97#.33q0r7hhm
Node Proxy (Optional): https://github.com/benoror/airtable-api-proxy
Ember addon for Airtable APIs
Dummy app: https://github.com/benoror/ember-airtable/tree/master/tests/dummy/app
*Originally based on: https://github.com/benoror/fieldbook-app
ember install ember-airtable
Use AirtableAdapter as you application's main adapter:
import AirtableAdapter from "ember-airtable/adapter";
export default AirtableAdapter.extend({
// API Version + Base ID
namespace: 'v0/app_YOUR_AIRTABLE_BASE_KEY',
headers: {
'Accept': 'application/json',
// API Token
'Authorization': `Bearer key_YOUR_AIRTABLE_API_KEY`
}
});
Use AirtableSerializer as you application's main serializer:
import AirtableSerializer from "ember-airtable/serializer";
export default AirtableSerializer.extend();
If you want to skip persistance of certain attributes (ex. formula columns) add the readOnly
option:
import DS from 'ember-data';
export default DS.Model.extend({
formula: DS.attr('string', { readOnly: true })
});
You can use all of the API features when querying Airtable:
import Ember from 'ember';
export default Ember.Route.extend({
model() {
return this.store.query('product', {
// Only data for fields whose names are in this list will be included in the records.
fields: ['name', 'description'],
// A formula used to filter records.
filterByFormula: "NOT({name} = 'MacBook')",
// The maximum total number of records that will be returned.
maxRecords: 50,
// The number of records returned in each request.
pageSize: 10,
// A list of sort objects that specifies how the records will be ordered.
sort: [{field: "name", direction: "desc"}],
// The name or ID of a view in the table.
view: 'active_products'
});
}
});
git clone
this repositorynpm install
bower install
ember server
- Visit your app at http://localhost:4200.
npm test
(Runsember try:testall
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit http://ember-cli.com/.