{"错误":"在请求中指定了无效的API版本,此请求需要指定2.0.0的ZUMO-API-VERSION。"}

时间:2017-03-21 02:40:17

标签: angularjs azure ionic-framework

我最近在尝试注册我的应用程序时收到此错误。

{"错误":"在请求中指定了无效的API版本,此请求需要指定ZUMO-API-VERSION为2.0.0。"}

之前有效,这是一个非常新的错误

控制器文件......

.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);
    });




};


}])

2 个答案:

答案 0 :(得分:1)

您需要在API调用中添加API版本。您可以将其添加为查询字符串

?ZUMO-API-VERSION=2.0.0

或作为http标头

HEADERS: ZUMO-API-VERSION: 2.0.0

更多信息:https://docs.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-client-and-server-versioning

答案 1 :(得分:0)

它随机开始工作......也许我的服务器正在更新或我的工作室。谢谢你的帮助