Azure mobile services Custom API GET not returning XML instead Json -


lately started looking azure mobile services , liked it. prefer working asp.net web api mobile solutions or fast rest api development liked approach. trying figure out custom apis, when added controller/custom api on of web apis code mobile project. it's working pretty , simplified when see response it's giving xml json response compared other todo items api's.

using system; using system.collections.generic; using system.linq; using system.net; using system.net.http; using system.web.http; using microsoft.windowsazure.mobile.service; using system.threading.tasks; using projectservice.models; using newtonsoft.json;  namespace projectservice.controllers {     public class projectcontroller : apicontroller     {         public apiservices services { get; set; }          // api/search         public async task<movie> get(string term)         {             system.net.servicepointmanager.servercertificatevalidationcallback = delegate { return true; };              var baseaddress = new uri("http://api.themoviedb.org/3/");              using (var httpclient = new httpclient { baseaddress = baseaddress })             {                 httpclient.defaultrequestheaders.tryaddwithoutvalidation("accept", "application/json");                  using (var response = await httpclient.getasync("search/movie?api_key=key-id&query=" + term))                  {                     string responsedata = await response.content.readasstringasync();                      var model = jsonconvert.deserializeobject<movie>(responsedata);                      return model;                      //i tried return json allowget it's returning xml                     //return json(model, jsonrequestbehavior.allowget);                  }             }         }     } } 


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -