Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4797

Sharepoint Angular REST add item yields 400 (Bad Request)

$
0
0

I have been banging my head against the wall for a couple of days now. I'm trying to add an item to a list in Sharepoint with Angular js.

Retrieving items is smooth but adding items doesn't work for me.

Code:

spApp.controller('spListCtrl', function($scope, $http, $q) {    $http.post("https://tools.site.com/_api/lists/getbytitle('PersonalFilter')/items", {'Title': 'TEST'    }, {        headers: {'Accept': 'application/json; odata=verbose','X-RequestDigest': $("#__REQUESTDIGEST").val()        }    }).success(function(data, status, headers, config) {        console.log("YES");    }).error(function(data, status, headers, config) {});});

I have done this before with jQuery Ajax (in a similar fashion) but I can't seem to locate the problem.

The script is running on the same site as to where the call is made, so no Cross-Domain calling. Furthermore this is embedded with the script editor, so this is running directly inside a Sharepoint Masterpage.

Any suggestions?


Viewing all articles
Browse latest Browse all 4797

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>