Zendesk app POST method return status code 200 but body return null

396 views Asked by At
  1. When i use the request method on my endpoint it return me a code status 200 but my body is empty. Someone can help me ?

    $(function() {
      var client = ZAFClient.init();
      client.invoke('resize', { width: '100%', height: '500px' });
    
      client.get('ticket.requester.id').then(
        function(data) {
          var userId = data['ticket.requester.id'];
          requestUserInfo(client, userId);
        }
      );
    
    });
    
        function requestUserInfo(client) {
          var settings = {
            url: `${url}`,
            type:'POST',
            headers : {
              "Content-Type": "application/json",
              "authorizationToken": "allow",
            },
            body : JSON.stringify({
              user_id: `${user_id}`
            }),
          };
    
    
    
          client.request(settings).then(
            function(data) {
              console.log(data)
            },
            function(response) {
              showError(response);
            }
          );
        }
    
1

There are 1 answers

0
Jonny Pabon On

I think the reason you aren't seeing the expected results is because within your function requesterUserInfo method, you'll want to ensure you are passing in the ID as well and making sure to set the type to GET instead of a POST. The client.request(settings) method should have a .then that would display the data. I would kindly recommend reviewing the article shown from Zendesk:

https://develop.zendesk.com/hc/en-us/articles/360001074828