title: “MSXML2.ServerXMLHTTP” request returns NULL in SQL Server
body: <p>That's my first time trying to implement HTTP requests in SQL Server to get a JSON object and insert in my DB, but for some rease is always returning NULL for me.</p>
  
  <p>I'm using <a href="https://jsonplaceholder.typicode.com" rel="nofollow noreferrer">Json placeholder</a> to test it but no success.</p>
  
  <pre><code>sp_configure 'show advanced options', 1;
  GO
  RECONFIGURE;
  GO
  sp_configure 'Ole Automation Procedures', 1;
  GO
  RECONFIGURE;
  GO
  
  
  
  Declare @Object as Int;
  Declare @ResponseText as Varchar(max);
  Declare @Body as varchar(max);
  
  Exec sp_OACreate 'MSXML2.ServerXMLHTTP', @Object OUT;
  EXEC  sp_OAMethod @Object, 'open', NULL, 'get','https://jsonplaceholder.typicode.com/todos', 'false'
  
  Exec sp_OAMethod @Object, 'setRequestHeader', null, 'Content-Type', 'application/json'
  Exec sp_OAMethod @Object, 'send', null, @body
  
  Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT
  Select @ResponseText as response
  </code></pre>
  
  <p>Response:</p>
  
  <p><a href="https://i.stack.imgur.com/kGubj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kGubj.png" alt="enter image description here"></a></p>