Daniel Boyer
Daniel Boyer

Reputation: 401

{"error":"An invalid API version was specified in the request, this request needs to specify a ZUMO-API-VERSION of 2.0.0."}

I recently received this error when trying to sign up on my application.

{"error":"An invalid API version was specified in the request, this request needs to specify a ZUMO-API-VERSION of 2.0.0."}

It worked before and this is a very recent error

controller file...

.controller('signupCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName

function ($scope, $stateParams) {

    $scope.User = {};


    $scope.loadUser = function() {

    var client = new WindowsAzure.MobileServiceClient('azure client');
   var item = { FirstName: $scope.User.FirstName, LastName: $scope.User.LastName, Birthday: $scope.User.Birthday, PhoneNumber: $scope.User.PhoneNumber, Email: $scope.User.Email, StudentID: $scope.User.StudentID, GradeYear: $scope.User.GradeYear, ParentalGuardian: $scope.User.ParentalGuardian, ParentalGuardian2: $scope.User.ParentalGuardian2, PG1Number: $scope.User.GuardianNumber, PG2Number: $scope.User.GuardianNumber2, PG1Email: $scope.User.GuardianEmail, PG2Email: $scope.User.GuardianEmail2, Password: $scope.User.Password};
    client.getTable('clubUser').insert(item);




};

}])

.controller('loginCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($scope, $stateParams) {

$scope.User = {};

$scope.login = function() {

    var client = new WindowsAzure.MobileServiceClient('azure client');

    client.getTable('clubUser')
    .where({ EMAIL: $scope.User.email, PASSWORD: $scope.User.password })
    .read()
    .then(function() {
        console.log('It Worked');
        $state.go("tabsController.qRCode");
    }, function(error) {
        console.log('an error occurred while checking login:');
        console.dir(error);
    });




};


}])

Upvotes: 0

Views: 2295

Answers (2)

Daniel Boyer
Daniel Boyer

Reputation: 401

It randomly started working again... Maybe my server was updating or my studio was. Thank you for the help

Upvotes: 0

RAS
RAS

Reputation: 3385

You need to add API version to your API call. You can add it as a querystring

?ZUMO-API-VERSION=2.0.0

Or as an http header

HEADERS: ZUMO-API-VERSION: 2.0.0

More info: https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-client-and-server-versioning

Upvotes: 1

Related Questions