This post is one in a series on converting a Backbone app to Ember. See also Ember-Data Notes.
Recently, our team has been trying to get Ember-Data to work with an API that does not conform to the json:api
standard. The experience has been mostly good, but we've really struggled with the relationships. We have a Customer
model that has many pastInvoices
and a single monthToDateInvoice
. The URL for past invoices is /billing/invoice?explicit_customer_id={{customerId}}
; for month-to-date, it's /billing?no_list=true&explicit_customer_id={{customerId}}
. The JSON that the API returns for a customer does not include any link to those URLs.
Our first attempt was to create an InvoiceAdapter
that understood how to fetch invoices from those URLs:
// app/billing/invoices/adapter.js: