412 errors on Xero API using Classic ASP

I started to see errors on our calls to the Xero API, with status 412 returned. The initial clue was in this Xero Community post.

On windows 7 machines or older machines, you may need to install a fix to ensure that windows can handle TLS 1.1 or 1.2. I usually recommend this update as a first step as it mitigates not knowing how the underlying code, wrapper may work.

This led me to a post about TLS versions, with a useful piece of code to check the TLS version of your server:

Set objHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0")
objHttp.open "GET", "https://howsmyssl.com/a/check", False
Response.Write objHttp.responseText 
Set objHttp = Nothing 

Running this I found the particular VM was showing TLS1.0, which is not good. I recalled I’ve seen something similar a few weeks ago on another project which was calling the Vimeo API, which now requires TLS1.2 or above.

This particular server is 2008 R2, and there’s a patch to upgrade your TLS to 1.2.

I used the Windows Catalog Update link in the article plus used the Registry EasyFix to sort the registry key out.

Now the TLS test code above is returning

"tls_version":"TLS 1.2"

And my calls to the Xero API are working.