My API backend is in PHP, for each method api print a json result (GET, POST, PUT and DELETE)


/api/Download      GET      Print json result for all
/api/Download      POST     Print json result of new document
/api/Download/id   GET      Print json result from document
/api/Download/id   PUT      Print json result edited
/api/Download/id   DELETE   Print json result deleted

All methods is success in PostMan or Restlet the only method that works in AngularJs is query()

The results in API php:

header('Content-Type: application/json');
echo json_encode($result);

My Code AngularJS:

  return $resource('/api/Download/:id', {id: '@id'}, {
      'get':    {method:'GET'},
      'save':   {method:'POST'},
      'update': {method:'PUT'},
      'query':  {method:'GET', isArray:true},
      'delete': {method:'DELETE'}

My Controller:

app.controller('ProductoController', function($scope, $http, Download) {
  var d = new Download({
    version: 123,
    comentario: "test test"

The error in $save() is:

Error: $resource:badcfg
Response does not match configured parameter

0 Answers