Receiving model data via non-REST URL


#1

Assuming the following situation:

I’m about to create a football bet app, where users can bet on matches, comment on matchdays etc.

Frontend is Ember.js v1.13 Backend is Laravel 4.2

For getting the footbal fixtures and realtime updated data I use an api with the following schema: http://football-api.com/api/?Action=fixtures&APIKey=123456789&comp_id=1204&match_date=15.08.2015

This api returns already JSON formatted data. Of course, the parameters of this url have to be changed dynamically, depending on the request by the frontend.

I don’t want to save all the data in my database, only the referencing bets, comments etc.

How is it possible to retrieve the JSON responses and represent them as models like it used to be?

Past projects were only realized via REST adapter between Ember.js and Laravel and worked like a charm, but in this case, most of the data isn’t provided RESTful.

Thanks in advance!!!


#2

Something like this in your route?

import Ember from ‘ember’;

export default Ember.Route.extend({
	model: function() {
		return Ember.$.getJSON('http://football-api.com/api/?Action=fixtures&APIKey=123456789&comp_id=1204&match_date=15.08.2015').then(function(data) {
			return data;
		});
	}
});

#3

Thanks for the reply, hope I can check that later :sunglasses: