Initiate Workspace Backup
Initiate an on-demand backup of the specified workspace.
REQUEST URI
https://<ZohoAnalytics_Server_URI>/restapi/v2/workspaces/<workspace-id>/backups
Post
oauthscope: ZohoAnalytics.metadata.create
QUERY PARAMETERS
| Description |
|---|---|
| CONFIG | JSONObject Config parameter specifications are available in the below section. |
FIELDS FOR CONFIG JSON
| Description |
|---|---|
| backupMode | String The mode of the backup. Supported values: "STRUCTURE_AND_DATA", "STRUCTURE" STRUCTURE_AND_DATA - Backs up the workspace structure and all row data.STRUCTURE - Backs up only the workspace structure, without row data.The values are case-sensitive. Maximum length - 100 characters. Default value - STRUCTURE_AND_DATA. Sample: {"backupMode":"STRUCTURE"} |
Note: The CONFIG parameter is optional. If backupMode is not specified, a STRUCTURE_AND_DATA backup is initiated.
Note: The backup runs in the background. Use the Get Workspace Backup Status API to track its completion.
Sample Request:
Copiedcurl "https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/backups" \
-X 'POST' \
-H 'ZANALYTICS-ORGID: <org-id>' \
-H 'Authorization: Zoho-oauthtoken <access_token>' \
--data-urlencode 'CONFIG={"backupMode":"STRUCTURE"}'Copiedusing System;
using System.Collections.Generic;
using System.Text.Json;
using ZohoAnalytics;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777;
long workspaceId = 35130000001055707;
public void BackupWorkspaceNow(IAnalyticsClient ac)
{
Dictionary<string, object> config = JsonSerializer.Deserialize<Dictionary<string, object>>("{\"backupMode\":\"STRUCTURE\"}");
IWorkspaceAPI workspace = ac.GetWorkspaceInstance(orgId, workspaceId);
JsonElement result = workspace.BackupWorkspaceNow(config);
Console.WriteLine(result);
}
static void Main(string[] args)
{
string clientId = "1000.xxxxxxx";
string clientSecret = "xxxxxxx";
string refreshToken = "1000.xxxxxxx.xxxxxxx";
IAnalyticsClient ac = new AnalyticsClient(clientId, clientSecret, refreshToken);
Program obj = new Program();
obj.BackupWorkspaceNow(ac);
}
}
}Copiedpackage main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func BackupWorkspaceNow(ac ZAnalytics.Client) {
config := map[string]interface{}{
"backupMode": "STRUCTURE",
}
workspace := ZAnalytics.GetWorkspaceInstance(&ac, orgId, workspaceId)
result, exception := workspace.BackupWorkspaceNow(config)
if exception != nil {
fmt.Println(exception.ErrorMessage)
return
}
fmt.Println(result)
}
func main() {
ac := ZAnalytics.GetAnalyticsClient(clientId, clientSecret, refreshToken)
BackupWorkspaceNow(ac)
}Copiedimport com.zoho.analytics.client.*;
import org.json.*;
public class Test {
private long orgId = 55522777l;
private long workspaceId = 35130000001055707l;
public static void main(String args[]) {
String clientId = "1000.xxxxxxx";
String clientSecret = "xxxxxxx";
String refreshToken = "1000.xxxxxxx.xxxxxxx";
Test tObj = new Test();
AnalyticsClient ac = new AnalyticsClient(clientId, clientSecret, refreshToken);
try {
tObj.backupWorkspaceNow(ac);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void backupWorkspaceNow(AnalyticsClient ac) throws Exception {
JSONObject config = new JSONObject("{\"backupMode\":\"STRUCTURE\"}");
WorkspaceAPI workspace = ac.getWorkspaceInstance(orgId, workspaceId);
JSONObject result = workspace.backupWorkspaceNow(config);
System.out.println(result);
}
}Copied<?php
require 'AnalyticsClient.php';
class Test {
public $ac;
public $org_id = "55522777";
public $workspace_id = "35130000001055707";
function __construct() {
$this->ac = new AnalyticsClient("1000.xxxxxxx", "xxxxxxx", "1000.xxxxxxx.xxxxxxx");
}
function backupWorkspaceNow() {
$config = array(
"backupMode" => "STRUCTURE"
);
$workspace = $this->ac->getWorkspaceInstance($this->org_id, $this->workspace_id);
$response = $workspace->backupWorkspaceNow($config);
print_r($response);
}
}
$obj = new Test();
$obj->backupWorkspaceNow();
?>Copiedfrom AnalyticsClient import AnalyticsClient
class Config:
CLIENTID = "1000.xxxxxxx"
CLIENTSECRET = "xxxxxxx"
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx"
ORGID = "55522777"
WORKSPACEID = "35130000001055707"
class Sample:
ac = AnalyticsClient(Config.CLIENTID, Config.CLIENTSECRET, Config.REFRESHTOKEN)
def backup_workspace_now(self, ac):
config = {
"backupMode": "STRUCTURE"
}
workspace = ac.get_workspace_instance(Config.ORGID, Config.WORKSPACEID)
result = workspace.backup_workspace_now(config)
print(result)
obj = Sample()
obj.backup_workspace_now(obj.ac)Copiedvar analyticsClient = require('./AnalyticsClient');
var ac = new analyticsClient('1000.xxxxxxx', 'xxxxxxx', '1000.xxxxxxx.xxxxxxx');
var orgId = '55522777';
var workspaceId = '35130000001055707';
var config = {
"backupMode": "STRUCTURE"
};
var workspace = ac.getWorkspaceInstance(orgId, workspaceId);
workspace.backupWorkspaceNow(config).then((result) => { console.log(result); }).catch((error) => { console.log(error); });CopiedorgId = "55522777";
workspaceId = "35130000001055707";
headersMap = Map();
headersMap.put("ZANALYTICS-ORGID", orgId);
config = {"backupMode": "STRUCTURE"};
response = invokeurl
parameters = "CONFIG=" + zoho.encryption.urlEncode(config.toString());
[
url :"https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/backups"
type :POST
parameters:parameters
headers:headersMap
connection:"analytics_oauth_connection"
];
info response;Copiedrequire 'zoho_analytics_client'
class Config
ORGID = "55522777"
WORKSPACEID = "35130000001055707"
end
class Sample
def initialize
@ac = AnalyticsClient.new.with_data_center("US").with_oauth({
"clientId" => "1000.xxxxxxx",
"clientSecret" => "xxxxxxx",
"refreshToken" => "1000.xxxxxxx.xxxxxxx"
}).build
end
def backup_workspace_now
config = {
"backupMode" => "STRUCTURE"
}
workspace = @ac.get_workspace_instance(Config::ORGID, Config::WORKSPACEID)
result = workspace.backup_workspace_now(config)
puts result
end
end
obj = Sample.new
obj.backup_workspace_nowDownload client libraries: C# | GO | JAVA | PHP | PYTHON | NodeJS | Ruby
Sample value for CONFIG parameter:
Copied{
"backupMode": "STRUCTURE"
}Sample Response:
CopiedHTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status": "success",
"summary": "Backup workspace now",
"data": {
"backupId": "466206000000318041",
"backupMode": "STRUCTURE_AND_DATA",
"status": "IN_PROGRESS"
}
}