Vai al contenuto

Command-line tools

You can interact with the Invoicetronic API from the command line. That is convenient because you don't need to be a programmer and you can automate tasks via cronjobs or other means. This page presents you with two convenient tools to achieve this goal.

  1. invoice. Easily exchange invoice files from the command line.
  2. curl. The de facto standard in command line data transfer.

invoice

You don't need to learn the API or any programming language to send and receive invoices. The invoice command lets you quickly and intuitively exchange invoice file(s) from the command line.

At a glance

Sending an invoice can be as simple as issuing this command:

invoice send file1.xml
Say you have many files to upload, you can use wildcards:

invoice send *.xml --delete
invoice send file1.xml file2.xml file3.xml

In the first line above, we're also deleting files from the disk once successfully uploaded.

Receiving files is also super simple:

invoice receive --unread

The above will download all new invoices and store them in the current directory.

Quickstart

How to use invoice with the Invoicetronic API

Features

The invoice command is designed for simplicity and has just one clear goal: to exchange invoice file(s) from the command line. There are very few specific commands, each geared towards a simple task.

Upload

The send command uploads invoice file(s) to the SDI.

  • Plain invoice file (.xml)
  • Signed invoice file (.xml.p7m)
  • Base64-encoded invoice file
  • Bulk upload
  • Pre-flight invoice validation (option)
  • Delete local file(s) once successfully uploaded (option)
  • Apply a digital signature to unsigned files (option)

Download

The receive and get commands download invoices from the SDI.

  • Single invoice
  • Bulk download
  • Save to a specific destination (option)
  • Only unread invoices (option)
  • As JSON, to pipe the output to more tools (option)
  • Delete remote invoice once successfully downloaded (option)

Configuration

The config command lets us persist some settings so we don't have to repeat ourselves:

  • Verbose mode on/off
  • API key persistence
  • Remote host address
  • Use alternate config file

Installation Guide

invoice command-line application is available for Windows, macOS, and Linux.

Windows

  1. Go to the Releases page
  2. Download the appropriate file for your CPU:

    Download Architecture
    invoice-[version]-windows-x64.zip 64-bit Intel/AMD
    invoice-[version]-windows-x86.zip 32-bit Intel/AMD
    invoice-[version]-windows-arm64.zip ARM devices
  3. Open Command Prompt or PowerShell and navigate to the download location:

    cd C:\path\to\downloads
    

  4. Extract the ZIP file:

    tar -xf invoice-[version]-windows-[architecture].zip
    
    If tar does not exist on your system, you'll have to decompress it either with Expand-Archive (PowerShell) or manually, with the Windows Explorer.

  5. Run the application:

    invoice --help
    

Optional: Add to PATH for system-wide access:

  1. Copy invoice.exe to a permanent location
  2. Add that location to your PATH environment variable
  3. Restart Command Prompt/PowerShell

macOS

  1. Go to the Releases page
  2. Download the appropriate file for your CPU:

    Download Architecture
    invoice-[version]-macos-amd64.tar.gz 64-bit Intel/AMD
    invoice-[version]-macos-arm64.tar.gz M1/M2/M3 Macs
  3. Open Terminal and navigate to the download location:

    cd ~/Downloads
    

  4. Extract the archive:
    tar -xf invoice-[version]-macos-[architecture].tar.gz
    
  5. Run the application:
    ./invoice --help
    

Optional: Move to system PATH:

sudo mv invoice /usr/local/bin/

Linux

  1. Go to the Releases page

  2. Download the appropriate file for your CPU:

    Download Architecture
    application-[version]-linux-amd64.tar.gz 64-bit Intel/AMD
    application-[version]-linux-i386.tar.gz 32-bit Intel/AMD
    application-[version]-linux-arm64.tar.gz ARM devices Intel
  3. Open terminal and navigate to the download location:

    cd ~/Downloads
    

  4. Extract the archive:
    tar -xf invoice-[version]-linux-[architecture].tar.gz
    
  5. Run the application:
    ./invoice --help
    

Optional: Move to system PATH:

sudo mv invoice /usr/local/bin/

curl

curl is the de facto standard in command-line data transfer. It is ubiquitous and used daily by virtually every Internet-using human, albeit probably unbeknownst to them.

Like invoice, you don't need to write a program to work with the Invoicetronic API, but it is more complex and has a steeper learning curve. It allows you to interact with all API endpoints and perform many tasks, not just send and receive invoices.

Quickstart

How to use curl with the Invoicetronic API