1

I want to create a service to connect to the prestashop API and use it. The prestashop API is like this:

http://APIKEY@domain/api/module

How can I use ngResource to support APIKEY params in the path and also allow cross-origins to connect another domain?

My sample code that doesn't work is:

    .factory('Presta_Products', function ($resource) {
  var data = $resource('http://1111111111111111111@localhost/shinatech/OnlineStore/prestashop/api/products/:id', {id: '@id'}, {
    update:{
      method:'PUT'
    }
  });
  return data;
})

It gives the error:

enter image description here

Matteo Enna
  • 1,285
  • 1
  • 15
  • 36
  • I've managed to get the authentication part working by using $httpProvider.interceptors and $base64, so that every request uses an Authorization token... Using $http, I was able to return xml data and translate it to json. Somehow it seems more difficult to achieve this using $resource... – PatrickS Aug 25 '16 at 05:02

0 Answers0