Last modified October 31, 2024

JETAPI Documentation

Overview

Introduction

JetBackup API accesses the JetBackup interface's features.
You can use this API to perform all the tasks you perform from the JetBackup GUI and more,
With JetBackup API you can create destinations, jobs, and manage settings etc.

API Token

API keys/tokens allow you to log in to the server without the need for a password. You can use an API key/token to authenticate with JetBackup's remote API. Visit API keys/tokens for more details on how to retrieve it on supported platforms.

<?php
    $user = "root";

    /*
    * cPanel Token
    * $token = "MYAPITOKEN";
    *
    * cPanel API URL
    * $query='https://HOST_NAME:2087/cgi/addons/jetbackup5/api.cgi'
    *
    * DirectAdmin Login Key
    * $auth = base64_encode($user . ":". $key);
    *
    * DirectAdmin API URL
    * $query='https://HOST_NAME:2222/CMD_PLUGINS_ADMIN/jetbackup5/index.raw?api=1'
    *
    * Linux Token
    * $key = "MYAPITOKEN";
    * $auth = $user . ":". $key;
    *
    * Linux API URL
    * $query = "https://HOST_NAME:3035/?api=1";
    *
    *
  **/

    $params = [
      'function' => 'listBackupForAccounts',
      'type' => 1,
      'contains' => 511
    ];

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

    /*
    * cPanel Header
    * $header = ["Authorization: whm $user:$token"];
    *
    * DirectAdmin Header
    * $header = ["Authorization: Basic $auth"];
    *
    * Linux Header
    * $header = ["Authorization: Bearer $auth"];
    **/

    curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
    curl_setopt($curl, CURLOPT_URL, $query);
    curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params));

    $result = curl_exec($curl);

    $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

    if ($http_status != 200) {
        echo "[!] Error: " . $http_status . " returned\n";
    } else {
        $json = json_decode($result);
        print_r($json);
    }

    curl_close($curl);
?>
jetbackup5api backup -F listBackups -D "type=127"
#! /bin/bash
user=root

# cPanel Token
# token=MYAPITOKEN
# header="Authorization: whm $user:$token"

# DirectAdmin Login Key
# key="MYAPIKEY"
# auth=$(printf "%s" "${user}:${key}" | base64 -w 0)
# header="Authorization: Basic $auth"

# Linux Token
# key="MYAPITOKEN"
# auth="$user:$key"
# header="Authorization: Bearer $auth"

# cPanel API URL
# query="https://HOST_NAME:2087/cgi/addons/jetbackup5/api.cgi"

# DirectAdmin API URL
# query="https://HOST_NAME:2222/CMD_PLUGINS_ADMIN/jetbackup5/index.raw?api=1"

# Linux API URL
# query="https://HOST_NAME:3035/?api=1"

params="{\"function\":\"listBackupJobs\"}"

curl "${query}" -H "${header}" -d "${params}" -k

NOTE: Non-alphanumeric characters except _ need to be replaced with its url-encoded counterpart %XX.

Example: the parameter "key=123+abc" will need to be written as "key=123%2Babc".

For more information about jetapi basic usage click on JetBackup API Parameters

API Response

| On each function page, you will find details for the response data. | All the API call returns this object:

{
   "success":1,
   "message":"",
   "data":{},
   "system":
   {
      "version":"5.1",
      "tier":"STABLE",
      "type":"Linux",
      "disabelui":false,
      "dr":false,
      "agreement_panel":false,
      "agreement":false,
      "licenseIssue":false
   }
}

Parameters

Name Type Description Possible Values Example
sucess Boolean Whether the API call was successful
message String Success/failure message. You already have a download for this backup.
data Object The returned data.
system Object System information.