Scott Watermasysk

Still Learning to Code

Accessing a Restful Service With Ruby via NTLM

I have been looking for an easy to use library for accessing a restful service which sits behind NTLM via Ruby for sometime now and had been largely unsuccessful until now!

Last night after a bit more googling, I went back to twitter for help. Grant Carpenter put me on the right path with this:

I had the ntlm part working by patching rubyntlm (and then modifying savon). next stop: wsdl impedance

The bitly link above points to a defunct project ruby-httpclient. However, it appears to have been reborn as httpclient with its source now hosted on gitub.

Getting a sample up and running could not be easier.

gem install httpclient
gem install rubyntlm

Note: If you are still doing sudo gem install and not using RVM you are really missing out.

require 'httpclient'

domain = ''
user = 'username'
password = 'password'
client =
puts client.get("#{domain}/my-path/service/something.json").content

I have only been using the httpclient library for an hour or so, but so far the it appears to be very robust with built in support for just about everything Http.