Zendesk Apps tutorial - Getting data from an external application Follow



  • Avatar
    Krzy Hamer

    Hi, is there any chance to get data from RESPONSE Headers while using ZAFClient.request?
    I'm getting only the body as one argument in a response.

  • Avatar
    Jessie - Community Manager

    Welcome to the Community Krzy! Let me see if I can find an answer for you on this. Stand by!

  • Avatar

    Hey Krzy - 

    Sorry for the delay here! In test I wasn't able to find a way to get response headers when using client.request. 

    var fetchSelf = {
      url: '/api/v2/tickets/123.json',
      type: 'GET',
      dataType: 'json'

    function doit() {
    client.request(fetchSelf).then(function(data) {

    I would always get an undefined response: 

    I reached out to our Product team and they confirmed client.request only returns the data object; it will not return response headers. Our Product team has however added this as a feature request for the Apps Framework roadmap. Sorry for the limitation here!

    For some background, here's how client.request operates on the backend:

    The options passed to request are sent to the framework via postMessage and then given to jQuery.ajax, so all options jQuery supports that can be converted to JSON will, in theory work. For example, headers can be passed since it's a plain object, whereas beforeSend will not since functions cannot be converted to JSON. 

Please sign in to leave a comment.

Powered by Zendesk