title: Salesforce LiveAgent Rest API 400 Bad Request Error
body: <p>I'm trying to make a simple REST GET request to salesforce Live Agent API to check whether service is available.</p>
  
  <p>I can make the simple GET request successfully from my Web based REST client (Chrome Plugin - Boomerang) but am unable to successfully make the request from JQuery $.ajax.</p>
  
  <p>I am getting a 400 Bad Request error.</p>
  
  <pre><code>$(document).ready(function(){
       checkAvailable("https://d.xxx-xx-xxx.salesforceliveagent.com/chat/rest/Visitor/Availability?org_id=xxxxxxxxxxxxxxx&amp;deployment_id=xxxxxxxxxxxxxxx&amp;Availability.ids=[xxxxxxxxxxxxxx]");
  });
  
  function checkAvailable(URL)
  {
      $.ajax({
          url: URL,     
          type: "GET",
          beforeSend: function(xhr){
              xhr.setRequestHeader('X-LIVEAGENT-AFFINITY', "null");
              xhr.setRequestHeader('X-LIVEAGENT-API-VERSION', "41");
              },
          success: function(response) { alert('Success: ' + response); },
          error: function(req, err){ console.log('Error Message: ' + err); }
       });
  
  }
  </code></pre>
  
  <p>Can anyone shed some light on what I might be doing wrong ? I suspect the issue is with the data format but my Rest client has no issues with it.</p>