Q:

"Unexpected Error While Parsing Value" using InvokeApiAsync Method of Xamarin Azure Mobile Services Component 1.1.0

I was trying to use "InvokeApiAsync" methohd of Xamarin Azure Mobile Services Component 1.1.0 as mentioned below : 
var result = await _nativeClient.InvokeApiAsync ("insertsample", HttpMethod.Post, null);

I get an exception saying :
  {Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing                value: O. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue () [0x00000] in <filename unknown>:0 
at Newtonsoft.Json.JsonTextReader.ReadInternal () [0x00000] in <filename unknown>:0 
at Newtonsoft.Json.JsonTextReader.Read () [0x00000] in <filename unknown>:0 
at Newtonsoft.Json.Linq.JToken.ReadFrom (Newtonsoft.Json.JsonReader reader) [0x00000] in <filename unknown>:0 
at Newtonsoft.Json.Linq.JToken.Load (Newtonsoft.Json.JsonReader reader) [0x00000] in <filename unknown>:0 
at Newtonsoft.Json.Linq.JToken.Parse (System.String json) [0x00000] in <filename unknown>:0 
at Microsoft.WindowsAzure.MobileServices.StringExtensions.ParseToJToken (System.String response) [0x00000] in <filename unknown>:0 
at Microsoft.WindowsAzure.MobileServices.MobileServiceClient+<InvokeApiAsync>d__6.MoveNext () [0x00000] in <filename unknown>:0 

Any pointers on how to solve this issue?
Thanks in Advance!

A:

The default overload of InvokeApiSync expects a JSON response. It sounds like you are not returning one. Try this:
exports.post = function(request, response) {
    response.send(200, {}); // note the empty JSON object
}

Alternatively, if you do not wish to return JSON, you can use a different overload of InvokeApiAsync that returns a HttpResponseMessage and then parse the response however you wish.

