0

I'm trying to access this api for an angular app I am trying to create, you can view it here:

http://plnkr.co/edit/H1bm1oaeBv3xE4sBL82U?p=preview

but it's not loading the data, anyone see what is wrong?

angular.module('FootballFixturesApp.services', []).
  factory('footballdataAPIservice', function($http) {

    var footballdataAPI = {};

    footballdataAPI.getFixtures = function() {
      return $http({
        method: 'JSONP', 
        headers: { 'X-Auth-Token': '613a6b6937394ae8a94d69f358f76902' },
        url: 'http://www.football-data.org/fixtures'
      });
    }

    return footballdataAPI;
  });
2
  • 2
    I dont think that url supports JSONP. And well you need to add callback argument as well, i.e url: 'http://www.football-data.org/fixtures?callback=JSON_CALLBACK' Check the network console, call comes back without wrapped data Commented Jan 19, 2015 at 21:47
  • it's hard to help you w/o API description provided Commented Jan 19, 2015 at 22:54

2 Answers 2

1

I had to fetch the data the following way in services.js:

 footballdataAPI.getFixtures = function() {

        $http.defaults.headers.common['Auth-Token'] = '<INSERT AUTH TOKEN HERE>';
        return $http.get('http://api.football-data.org/fixtures?callback=JSON_CALLBACK');

    };

The api provider gave me the auth token for access.

Sign up to request clarification or add additional context in comments.

Comments

0

you could use this angular module with a football-data.org api factory: https://github.com/JohnnyTheTank/angular-footballdata-api-factory

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.