Http Requests


I am in the early stages of creating an App to display additional information on users who have submitted tickets.  To do this I have created a REST web service using WCF which serves up data from our local customer database.

I've made my app as close as possible to the example Bookmarks app but I cannot get the HTTP requests to work.  Here is my app.js code:


function() { return { requests: { fetchUserData: function() { return { url: 'http://testing.policyworks.com/MaxDataService/APIs/MaxDataRetriever.svc/UserData/chad.pickerell@policyworks.com', type: 'GET' }; } }, events: { 'app.activated' : 'requestUserData', 'fetchUserData.always': function(e, data) { this.renderUserData((data || {}).userInfo); }, }, requestUserData: function() { this.ajax('fetchUserData'); }, renderUserData: function(userInfo) { this.userInfo = userInfo; this.switchTo('list', { userInfo: this.userInfo}); } }; }());

I am pretty sure all of my method calls are working as my 'list' template is showing up properly but my web service is not getting hit.  I feel like I am missing something small but significant.  Any help or suggestions would be much appreciated.


  • 0

    @chad that link doesn't seem to work for me. Is the service still running?

    One other thing to try is using console.log() for your calls. For example: 




    will give you the data object and let you see what's being returned. 

  • 0

    @Adam, sorry I was hosting the service on my local machine.  You should now be able to reach it at:


    This will return some test data in json.

  • 0

    @Chad I'm not getting anything back when I hit that URL. 

  • 0

    @Adam, this one should work now:


    I've tested it from outside our local network and was able to get some data back.

  • 0

    @Adam, I should also mention that the default return type is json but I've seen some browsers (ie. Chrome) return it as xml.  It depends on the value of the 'Content-Type:' header in the request.  Do http requests in the zendesk apps support the addition/modification of the http request headers?

  • 0

    App AJAX requests take all of the options that jQuery.ajax does, so if you want to set the Accept header to "application/json", set dataType to "json":

    fetchUserData: function() { return { url: 'http://...', type: 'GET', dataType: 'json' }; }

Please sign in to leave a comment.