ElexonRCLIfrom SopherApps
  • Name ElexonRCLI
  • Summary A commandline app for getting data from Elexon REST API, processing it and saving it in a PostgreSQL database
  • Price (Monthly) 0 UGX
  • Free FREE forever
  • Category ETL
  • Tags rest elexon bmrs extract
  • Download

What ElexonRCLI is:

ElexonRCLI should not be confused with ElexonPCLI. The former is for the REST API while the latter is for the Data Push realtime service of Elexon's BMRS service.

ElexonRCLI is a commandline application built with love by SopherApps, by the grace of God. Its main purpose is to process in the XML data Elexon, a UK National Grid Monitoring Agency provides via its REST API. It is ideally for getting historical data from Elexon.

ElexonRCLI processes this data and saves in a PostgreSQL database.

In order to retrieve data for a given service type, you need to pass in the name of that service e.g. 'BOD'. The bmrs api data push user guide has a list of these service types.

You also need to provide the start and end date of the data you need to extract.

ElexonRCLI can even run on your local PC (Personal Computer) as long as it has any of Linux, Windows or MacOS operating systems.

ElexonRCLI comes with its own set of commands including a 'help' section and even an ability to update itself when a new version is released.

What Elexon is:

Just for those of us who may not know; United Kingdom has a decentralized way of balancing their electricity grid. That mechanism allows a number of players to buy and sell electricity, even when they don't have physical generation plants. Elexon provides the data that helps such players make the best buying or selling decisions they can make.

This decentralized way of balancing the electricity grid is normal in Europe.

You can get more information about Elexon from their official website.

  • Free: It is free to use forever.
  • CLI: A fully-fledged CLI app with a help section
  • XML to DB: Extracts the XML data processes it and saves it in a PostgreSQL database of your choice.
  • Automatic Updates: At start up, it checks for new updated versions automatically and advises the user to download if there are new versions. It continues to do these checks even when running and alerts the user when new versions are released.
  • Configurable: Almost everything about ElexonRCLI can be reconfigured. However, it comes with sensible defaults to get you running quickly.
  • Available for Major OS: Binaries for Linux, Windows and MacOS (Darwin) have been provided.
Quick Start

The application has been built for particular operating systems and architecture. The operating systems include: Linux, Windows or MacOs. The most common architecture is amd64. Start with that. If it fails then try other architecture.

  • Download the executable file. To download, go to the downloads section below and choose the version, the operating system and the architecture you want. In this section, we are assuming a UNIX system. For windows the file will be 'elexonrcli.exe'.
  • Open your terminal (command line) and change your directory to the place where you downloaded the app. For example for Ubuntu, it might be:

cd ~/Downloads

  • In case you just wish to run the application on local PC, you can skip the next three steps.
  • To push the executable file to your Linux debian/ubuntu server if you wish to run the app on a server, you can use the scp command. For example for a server with user 'soppy' and IP address '' with a folder 'apps', you can do:

scp elexonrcli soppy@

  • Log into your Linux debian/ubuntu server's terminal

ssh soppy@

  • Enter your the directory where you pushed the file. For our example, it was 'apps'

cd apps

  • Ensure you have already registered with Elexon and you have an Elexon Scripting key. You can register or login with Elexon via the elexon portal. More instructions can be found in their bmrs api data push user guide.
  • Run the application using the run command. For example if my Elexon scripting key is 'sopherflous' and my postgreSQL db is hosted on a server of IP address '' running on port '5432' and the database name is 'elly_db' and the db user is 'posty' and I am interested in BOD messages of between 2021-05-31 to 2021-06-01 then

./elexonrcli run --key sopherflous --dbhost --dbport 5432 --dbname elly_db --dbuser posty --service BOD --from 2021-05-31 --to 2021-06-01

  • Don't worry about having to remember all these flags. They can all be seen by running the help command.

./elexonrcli help

  • Also to see the possible service types and the corresponding messages they return, you can just run the 'services' command like:

./elexonrcli services

  • You can also use abbreviated flags. For example for the command we ran earlier, it could have easily been run as:

./elexonrcli run -k sopherflous -H -P 5432 -N elly_db -U posty -s BOD -f 2021-05-31 -t 2021-06-01

  • You can even go further and reduce the command to only have your scripting key and the database name if your database is on the same machine (localhost) and the database user 'postgres' still exists and has enough privileges. The command we had earlier thus becomes:

./elexonrcli run -k sopherflous -N elly_db -s BOD -f 2021-05-31 -t 2021-06-01

  • When the above command runs, you will be asked to feed in the password of the database user you have opted to use and then the processing will start. The terminal will print a short description of every Elexon message received.
  • You can then check your database for the data being fed into it. It is pretty fast. Be warned.
  • When all the data is processed, it will exit itself.
  • To stop it prematurely, you can press 'Ctrl-C'
  • Remember this application is free forever. We will keep maintaining it as long as God enables us to.