Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function agent(agentID, ticketId) {  
  2.   var API_KEY = "F4YhFJLDl03YomZFcYS";
  3.   var FD_ENDPOINT = "movavi";
  4.  
  5.   var PATH = "/api/v2/tickets";
  6.   var URL = "https://" + FD_ENDPOINT + ".freshdesk.com" + PATH + "/" + ticketId;
  7.  
  8.   var fields = {
  9.     'responder_id': agentID
  10.   };
  11.  
  12.   var Request = unirest.put(URL);
  13.  
  14.   Request.auth({
  15.     user: API_KEY,
  16.     pass: "X",
  17.     sendImmediately: true
  18.   })
  19.     .type('json')
  20.     .send(fields)
  21.     .end(function (response) {
  22.       //console.log('----------------------------');
  23.       //console.log(response.body);
  24.       console.log("update.agent Response Status : " + response.status);
  25.       //console.log('----------------------------');        
  26.       if (response.status != 200) {
  27.         console.log('agentID: ' + agentID, typeof agentID);
  28.         console.log('update.agent Response: ' + JSON.stringify(response.body));
  29.         console.log("update.agent X-Request-Id :" + response.headers['x-request-id']);
  30.       }
  31.     });
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement