Skip to content

Deploy Rest API

This document covers the agent/server protocol used by the "deploy" task.

This module is used to do remote software deployments and command executions.

Jobs request



This method returns the jobs to process for a given machine.

Everytime the agent request this URL, the server has to send it. Otherwise (empty page) the agent won't continue. This page will be requested everytime the task is started.

If a job has been processed, the server must remove it from the job list.


Jobs are processed in the order given by the server.

See Deploy REST API server answer samples

Answer structure format (jobs)


a list of operation to process

messageBox: Display an alert to the currently logged user.

  • msg: a hash table. keys are language code and the value are the strings. "default" is the default language.
  • type: the type of box to display to the user. info is an info box. postpone lets the user decide if the installation should be postponed.


messageBox action planned for later support
Still not supported in Deploy v2.1.0 from FusionInventory-Agent v2.3.18

cmd: Execute a command

  • retChecks: an array of rule to eval to know if the command successed. Order matter. (types are: okPattern, errorPattern, okCode, errorCode)
  • exec: a string with the command the launch. 2>&1 is added as suffix by the agent at the run time.
  • envs: a hash of environment variable to set before the cmd execution
  • logLineLimit: the number of line to keep in the log (optional, default 3)

move: Move a file or directory

  • from: source file or directory (* are accepted)
  • to: destination file or directory

copy: Copy a file

  • from: source file or directory (* are accepted)
  • to: destination file or directory

delete: Delete a list of file or directory. The command works like rm -Rf $arg

  • list: a list of file or directory to remove

mkdir: Create a list of directory

  • list: a list of directory to create

installPkg (draft/not implemented)

  • name: the package name.
  • method (optional): the method to use to install the package, (apt,yum).
  • repo (optional): the repository to use, e.g: backport-wheezy or epel.
  • version (optional): the version to use, e.g: ">= 3", "= 3.0-2".


The files (sha512 reference) to be downloaded. Those sha512 must be listed in the associatedFiles section (array) of the answer.


A array of check to evaluate. The code returned to the server and their behaviors a describe below.

  • winkeyExists: true if $path is a valid key in the Windows registry.
  • winkeyEquals: true if the content of $path in the registry is equal with $value
  • winkeyMissing: true if $path doesn't exist in the Windows registry.
  • fileExists: true if $path is a valid plain file.
  • fileSizeEquals: true if $path is a file and if its size equals $value (Byte).
  • fileSizeGreater: true if $path is a file and if its size is greater than $value (Byte).
  • fileSizeLess: true if $path is a file and if its size is less than $value (Byte).
  • fileMissing: true is $path is not a file.
  • freespaceGreater: true if $path freespace is greater than $value (MByte).


Registry path must:

  • start with the complete hive name (HKEY_something)
  • use the / delimiter (not \ )

A check failure will stop a job and the type of failure can be interpreted like the following:

  • ignore: this failure is normal and the job can be treated sucessful.

    For example, the package is already installed or uninstalled

  • error: this failure is unexpected and the job must be treated like a critical error.

    For example, there is no more space left on the harddrive to process installation.

Answer structure format (associatedFiles)

Only the files used by the jobs must be in this list.

  • name : the local name of the file

  • uncompress : should the archive be extracted

  • mirror: an array of base URL
    The mirror path must ends with a / if needed. The agent will join the mirror path directly with the multipart file name. The sha512 checksum is done after the optional gzip.

  • p2p : does the file be shared with other agents ?

  • p2p-retention-duration: how long an archive must be kept for sharing before its deletion from cache (minutes)

Update jobs' status



The agent uses this method to update the status of the deployment.

  • action=setStatus: the method name
  • machinedid=$machineid: the machine unique id (mandatory)
  • part=$part: either 'file' or 'job' (optional, default=job)
  • uuid=$uuid: the job UUID (mandatory)
  • sha512=$sha512: the sha512 of the file (mandatory if part=file)
  • status=$status: 'ko', 'ok'
  • currentStep=$currentStep: received/checking/downloading/extracting/processing (mandatory)
  • msg=$msg: a 120 character length string, this string must be static in order to reduce the transalation effort. (optional)
  • log=$log: log file sent through in UNIX format (\n). (looks below)
  • checknum=$checknum: the check number (optional), start at 0
  • actionnum=$actionnum: the action number (optional), start at 0

Current Step:

  • received (job): the agent received the job request (not implemented)
  • downloading (file) the agent started to check the mirror to download the file
  • extracting (job): preparing the working directory
  • processing (job): the agent is processing the job

The status:

  • ko (job, file): the job processing or the file downloading had been abort
  • ok (job, file): the job processing or the file downloading had been successful

The log:

The log length shouldn't be greater than 1000 caracters. If the value is above, the begining may be silently truncated by the agent.


The expected answer is a JSON encoded empty hash ref {}.


The multipart is the list of the file to download (from one to unlimited). This can file name can include a relative directory path too. Once the downloads are down, they will be joined together in the list order. If the subfile has a .gz suffix, it will be extracted first.

The agent will use the .gz extension of the part file to identify an optional compression. So be careful if the initial file has already this extension, you need to rename it to something like file.tar.gz-01.


POST a log file for a given job.



if [ -z $FILE ]; then
echo "exit"
exit 1
split $FILE $FILE

sha512=`sha512sum $FILE|awk '{print $1}'`
echo "

\"$sha512\" : {
\"uncompress\" : 1,
    \"mirror\" : [
    \"p2p\" : 1,
    \"multipart\" : ["
for part in $FILE?*; do
    [ ! -z $first ] && echo ','
    echo {\"$part\" : \"`sha512sum $part|awk '{print $1}'`\"}

echo "
    \"name\" : \"$FILE\"

Communication examples

Get the job, download the file and run the command.


Failed to download the file 60ace8e(...)


Fails to run a command and set the log file.


Run a command without issue.


Second action (actionnum=1) failed.