Simple tool to download code from IDE

I’ve made a simple tool available that can download the agent and device code for your Electric Imp models.

You can download it from GitHub here:

If you unzip this you’ll find a README and the file get-code.js - to use just run this file with node.

The first time you run it it will ask you for your Imp IDE email address and password (you can use your username instead of your email address if you prefer).

It will then show you a list of your models - if you enter the name of one of these it’ll download the model’s agent and device code to the files agent.nut and device.nut.

When it logs in it is given a token by the IDE service - the tool gives you the option to save this token and so avoid having to go through the login step the next time you use it.

This tool requires Node.js - if you don’t have it installed already you can download it from:

If you’re using a Linux system you can simply install it using your package manager, e.g. on Ubuntu you just need to do:

$ sudo apt-get install nodejs

Note: recent Ubuntu versions have unhelpfully renamed main executable from node to nodejs (as some obscure packet radio package already used the name node).

This script is very simple and has only limited error checking. There are no end of improvements that one could make. It doesn’t even hide your password as you enter it and it uses http rather than https.

It uses the undocumented API that the web based IDE uses so the script will most probably break at sometime in the future if the Electric Imp guys change anything.

I presume many other people have written something similar? But after a quick search the only thing I found was the upload script from @mikob that, in addition to Node.js, depends on curl and on you having logged into the IDE using Firefox.

My script does not depend on you having logged into the IDE using any browser (it handles the login process itself) and all it does is download code - so allowing you e.g. to easily store the code to somewhere like GitHub.

I used Node.js as this makes it easy to work with the JSON objects returned by the various http requests - obviously a bash/curl version would be nice as that would make it available to more people without requiring Node.js to also be installed.

Hope you find the script useful,


We’re actually getting ready to launch a beta API that will allow you to manage devices, models, etc through web requests. We’ve been testing it internally and building a couple tools with it, and we’re about ready for a group of external devs to take a look as well.

If you send me your email address, I can get you added to the beta list :slight_smile: