0
votes

I am new to Windows Azure mobile services , and now i need to post sign up data to Mysql table in Windows Azure Mobile Services.

I have made a pojo class (USER) , and saved user entered data to them , and now calling custom api line using this line.

ListenableFuture<User> result = mClient.invokeApi( "signup", User.class );

        Log.d("try","THIS LINE IS OKAY");


        Futures.addCallback(result, new FutureCallback<User>() {
            @Override
            public void onFailure(Throwable exc) {
                createAndShowDialog((Exception) exc, "Error");
            }

            @Override
            public void onSuccess(User result) {
                createAndShowDialog( " item(s)inserted", "Success");

            }
        });
    }

I have created a Custom API , in Mobile Services ,

exports.post= function(request, response) { 
     var queryString = "INSERT INTO User (user_name, user_email) VALUES (?,?)" ;   

      request.service.mssql.query(queryString, [request.query.username, request.query.user_email], { 
          success: function(results) { 
                 request.respond(statusCodes.OK, results); 
          } 
     }); 
};

While running app , i am getting a Internal Server Error 500.

Any one please help me to resolve issue,

1
Do you see any errors in the log tab of the Azure portal for your mobile service?carlosfigueira
You're also not passing any parameters when you call the invokeApi method, and your custom API in the script is trying to read them (username, user_email). That will certainly lead to failures.carlosfigueira
I am trying default update method now..could you please have look to this thread stackoverflow.com/questions/32665472/… @carlosfigueiraSHINERAJ ARATHIL

1 Answers

0
votes

As mentioned by @carlosfiguera, you need to pass parameters to invokeApi. Here's he documentation on how to do this: How to: call a custom API in Android.