3

Tip: fetch missing data via the HTTP API

If you find yourself trying to get some data about a Zendesk object that isn't available from the Apps data API, you can use the HTTP API to fetch it. For example, in a ticket_sidebar app, you can get the requester's external_id as follows:

(function() {
return {
requests: {
fullUserData: function(userID) {
return {
url: '/api/v2/users/' + userID + '.json',
dataType: 'json'
}
}
},

events: {
'app.activated': function() {
this.ajax( 'fullUserData', this.ticket().requester().id() );
},

'fullUserData.done': function(data) {
this.switchTo('someTemplate', { external_user_id: data.user.external_id });
}
}
};
}());

There are no corresponding data events for "non-native" data.

22 comments

Please sign in to leave a comment.