Today the databasedotcom gem was announced. This is a giant leap forward for those of us using the old ActiveSalesforce (ASF) gem. Much freetime has been donated by many developers to keep the ASF gem current but this new gem appears to have dedicated developers within Salesforce working on it. The Heroku team specifically, and so from here forward this should be the gem to use for anyone needing to talk to Saleforce. A new era starts today! Go read the announcement blog post for details about what’s new.
I started playing with the gem and encountered an error at probably the most basic of requests. The solution however is simple.
I’ve set up my client and authenticated correctly, following the excellent instructions in the gem README. However, when I first called
client.list_sobjects I received a 404 error that read…
Databasedotcom::SalesForceError: The requested resource does not exist
Jumping into Pry (have you used Pry? It’s so much better than simple IRB) everything looked in order. It’s connecting to the correct instance of the website but the path it requested is “/services/data/v23.0/sobjects”.
The error appears because v23.0 is not a valid API version (as of the writing of this post). I forced it to use v22.0 and everything works.
Anyone else seeing this error, the fix is really easy. Just set the DATABASEDOTCOM_VERSION environment variable to 22.0
$: export DATABASEDOTCOM_VERSION=22.0
Make sure you say “22.0”. The “v” is prepended automatically and you have to use the “.0” also. “22” won’t work. There are several other environment variables available. You can find them listed at the url below
Hopefully this helps anyone experiencing the same error I received. And to all time travellers from the future, your current version may be higher than 22. Adjust accordingly and come see me with your TARDIS. 🙂