Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I would like to use Parse with AngularJS. I'm a new one in both... I'm trying to create a new user but i receive the error "bad request".

Could you help me?

Here is my controller (linked to two input html tags):

var myAppControllers = angular.module('myApp.controllers', []);

myAppControllers.controller('SignUpCtrl', ['$scope', '$http',
  function($scope, $http) {
    $scope.results = []

        $scope.signUp = function() {
         $http({method : 'POST',
                url : 'https://api.parse.com/1/users', 
                headers: { 'X-Parse-Application-Id':'xxx', 'X-Parse-REST-API-Key':'xxx'},
                params: {
                    where: {
                        username: $scope.username,
                        password: $scope.password
                    }

                }}  )
            .success(function(data, status) {
                $scope.results = data;
             })
            .error(function(data, status) {
                alert("Error");
            })
        }
  }]);

Thank you in advance

Benjamin

share|improve this question
    
I have never used parse.com and just had a look at the API. According to parse.com/docs/rest#users-signup there is no where object in the post data. –  dirkk Jul 4 '14 at 7:36
    
try using 'data' instead of 'params'. Params is used for appending onto the end of the url like a query string, data is used for submitting data when making a post request. –  M21B8 Jul 4 '14 at 9:08
    
Thanks I'm going to try with your comments –  bevrard Jul 4 '14 at 11:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.