Create AutoML Analysis Deployment
Create a deployment for an AutoML analysis model.
REQUEST URI
https://<ZohoAnalytics_Server_URI>/restapi/v2/automl/workspaces/<workspace-id>/analysis/<analysis-id>/models/<model-id>/deployments
Post
oauthscope: ZohoAnalytics.modeling.create
QUERY PARAMETERS
| Description |
|---|---|
| CONFIG | JSONObject Config parameter specifications are available in the below section. |
FIELDS FOR CONFIG JSON
| Key | Description |
|---|---|
| inputTableId * | Long Unique ID of the input table from which data will be read for AutoML analysis deployment. Constraints: Maximum length is 60 characters. |
| outputTable * | String Name of the output table where the prediction results will be stored. |
| scheduleDetails * | JSONObject Scheduling configuration for running the AutoML analysis deployment. For more details about structure of scheduleDetails attributes, click here. |
| outputColumns * | JSONArray List of column names that will be written to the output table as part of the prediction results. Constraints: Minimum 1 column, Maximum 100 columns. |
| predictionColumn * | String Name of the column for which predictions will be generated. |
| serverOption * | Long Specifies the server memory configuration for executing the AutoML deployment job. Allowed values: 1 → 8GB, 2 → 16GB, 3 → 32GB |
| timezone | String Timezone to be used for scheduling the deployment job. Example values: Asia/Kolkata, UTC, etc. |
| importType * | String Specifies how prediction results should be imported into the output table. Allowed values: APPEND, TRUNCATEADD, UPDATEADD
|
| matchingColumns | JSONArray List of column names used to match existing records in the output table when importType is UPDATEADD. Note: This attribute is mandatory only when importType = UPDATEADD. |
Structure of scheduleDetails Attributes
| Key | Description |
|---|---|
| calendarFrequency * | String Defines the frequency at which the deployment job should run. Allowed values: none, hourly, daily, weekly, monthly |
| interval | Integer Specifies the interval for the schedule based on calendarFrequency. Example: For hourly, interval = 3 means once every 3 hours. |
| hour | Integer Specifies the hour of the day (0-23) when the deployment job should be triggered. |
| hourInterval | Integer Specifies the hour interval between executions when applicable. |
| minute | Integer Specifies the minute within the hour (0-59) when the deployment job should be triggered. |
| weekDay | Integer Specifies the day of the week when the deployment job should be triggered. Allowed values: 1 to 7, where 1 = Sunday, 7 = Saturday |
| monthDay | Integer Specifies a particular day of the month when the deployment job should be triggered. Allowed values: 1 to 31 and 99 (last day of month). |
Sample Request:
Copiedcurl https://analyticsapi.zoho.com/restapi/v2/automl/workspaces/<workspace-id>/analysis/<analysis-id>/models/<model-id>/deployments --data-urlencode 'CONFIG={"inputTableId":"466206000000061002","outputTable":"Sales Analysis","outputColumns":["Sales","Product"],"predictionColumn":"Profit","serverOption":2,"importType":"append","scheduleDetails":{"calendarFrequency":"hourly","interval":3}}'
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'CopiedorgId = "55522777";
workspaceId = "<workspace-id>";
analysisId = "<analysis-id>";
modelId = "<model-id>";
headersMap = Map();
headersMap.put("ZANALYTICS-ORGID", orgId);
config = Map();
config.put("inputTableId", "466206000000061002");
config.put("outputTable", "Sales Analysis");
outputColumnsList = {};
outputColumnsList.add("Sales");
outputColumnsList.add("Product");
config.put("outputColumns", outputColumnsList);
config.put("predictionColumn", "Profit");
config.put("serverOption", 2);
config.put("importType", "append");
scheduleDetails = Map();
scheduleDetails.put("calendarFrequency", "hourly");
scheduleDetails.put("interval", 3);
config.put("scheduleDetails", scheduleDetails);
paramsMap = Map();
paramsMap.put("CONFIG", config.toString());
response = invokeurl
[
url :"https://analyticsapi.zoho.com/restapi/v2/automl/workspaces/" + workspaceId + "/analysis/" + analysisId + "/models/" + modelId + "/deployments"
type :POST
parameters:paramsMap
headers:headersMap
connection:"analytics_oauth_connection"
];
info response;Copiedusing System;
using System.Collections.Generic;
using ZohoAnalytics;
using System.Text.Json;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777;
long workspaceId = 35130000001055707;
public void CreateAutomlDeployment(IAnalyticsClient ac)
{
long analysisId = 466206000000197001;
long modelId = 466206000000197003;
long inputTableId = 466206000000061002;
string outputTable = "SalesDep";
string predictionColumn = "precol";
int serverOption = 1;
string importType = "APPEND";
List<string> outputColumns = new List<string>
{
"Sales",
"Region"
};
Dictionary<string, object> scheduleDetails = new Dictionary<string, object>
{
{ "calendarFrequency", "hourly" },
{ "interval", 3 }
};
IWorkspaceAPI workspace = ac.GetWorkspaceInstance(orgId, workspaceId);
JsonElement deploymentInfo =
workspace.CreateAutomlAnalysisDeployment(
analysisId,
modelId,
inputTableId,
outputTable,
outputColumns,
predictionColumn,
serverOption,
importType,
scheduleDetails,
null
);
Console.WriteLine(deploymentInfo.ToString());
}
static void Main(string[] args)
{
string clientId = "1000.xxxxxxx";
string clientSecret = "xxxxxxx";
string refreshToken = "1000.xxxxxxx.xxxxxxx";
try
{
IAnalyticsClient ac = new AnalyticsClient(clientId, clientSecret, refreshToken);
Program obj = new Program();
obj.CreateAutomlDeployment(ac);
}
catch (ServerException ex)
{
Console.WriteLine("Server exception - " + ex.GetErrorMessage());
}
catch (Exception ex)
{
Console.WriteLine("Other exception - " + ex.Message);
}
}
}
}Copiedpackage main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func CreateAutoMLDeployment(ac ZAnalytics.Client) {
analysisID := "466206000000100001"
modelID := "466206000000073003"
inputTableID := "466206000000061002"
outputTable := "SalesDep"
outputColumns := []interface{}{
"Sales",
"Region",
}
predictionColumn := "precol"
serverOption := 1
importType := "APPEND"
scheduleDetails := map[string]interface{}{
"calendarFrequency": "hourly",
"interval": 3,
}
workspace := ZAnalytics.GetWorkspaceInstance(&ac, orgId, workspaceId)
deploymentInfo, exception := workspace.CreateAutoMLAnalysisDeployment(
analysisID,
modelID,
inputTableID,
outputTable,
outputColumns,
predictionColumn,
serverOption,
importType,
scheduleDetails,
nil,
)
if exception != nil {
fmt.Println("Error:", exception)
return
}
fmt.Println("Deployment Details:", deploymentInfo)
}
func main() {
ac := ZAnalytics.GetAnalyticsClient(clientId, clientSecret, refreshToken)
CreateAutoMLDeployment(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.createAutoMLDeployment(ac);
}
catch (ServerException ex) {
System.out.println("Server exception - ErrorCode : " + ex.getErrorCode()
+ ", ErrorMessage : " + ex.getErrorMessage());
}
catch (ParseException ex) {
System.out.println("Parser exception - ErrorMessage : " + ex.getResponseMessage());
}
catch (Exception ex) {
System.out.println("Other exception - ");
ex.printStackTrace();
}
}
public void createAutoMLDeployment(AnalyticsClient ac) throws Exception {
String analysisId = "466206000000182001";
String modelId = "466206000000182005";
String inputTableId = "466206000000061002";
String outputTable = "Sales - 1";
JSONArray outputColumns = new JSONArray();
outputColumns.put("Sales");
outputColumns.put("Region");
String predictionColumn = "precol";
int serverOption = 1;
String importType = "APPEND";
JSONObject scheduleDetails = new JSONObject();
scheduleDetails.put("calendarFrequency", "hourly");
scheduleDetails.put("interval", 3);
WorkspaceAPI workspace =
ac.getWorkspaceInstance(orgId, workspaceId);
JSONObject deploymentInfo = workspace.createAutoMLAnalysisDeployment(
analysisId,
modelId,
inputTableId,
outputTable,
outputColumns,
predictionColumn,
serverOption,
importType,
scheduleDetails,
null
);
System.out.println("Deployment Details : " + deploymentInfo);
}
}Copied<?php
require 'AnalyticsClient.php';
class Test
{
public $ac = NULL;
public $client_id = "1000.xxxxxxx";
public $client_secret = "xxxxxxx";
public $refresh_token = "1000.xxxxxxx.xxxxxxx";
public $org_id = "55522777";
public $workspace_id = "35130000001055707";
function __construct() {
$this->ac = new AnalyticsClient($this->client_id, $this->client_secret, $this->refresh_token);
}
function createAutoMLDeployment() {
$analysis_id = "466206000000126001";
$model_id = "466206000000126003";
$input_table_id = "466206000000061002";
$output_table = "SalesDep - 1";
$output_columns = array("Sales", "Region");
$prediction_column = "precol";
$server_option = 1;
$import_type = "APPEND";
$schedule_details = array(
"calendarFrequency" => "hourly",
"interval" => 3
);
$workspace = $this->ac->getWorkspaceInstance(
$this->org_id,
$this->workspace_id
);
$deployment_info = $workspace->createAutoMLAnalysisDeployment(
$analysis_id,
$model_id,
$input_table_id,
$output_table,
$output_columns,
$prediction_column,
$server_option,
$import_type,
$schedule_details
);
echo "Deployment Details:\n";
print_r($deployment_info);
}
}
$test_obj = new Test();
try {
$test_obj->createAutoMLDeployment();
}
catch(ServerException $se) {
echo "Server exception : " . $se->getErrorMessage() . "\n";
}
catch(IOException $ioe) {
echo "IO exception : " . $ioe->getErrorMessage() . "\n";
}
catch(ParseException $pe) {
echo "Parser exception : " . $pe->getErrorMessage() . "\n";
}
catch(Exception $e) {
echo "ExceCopiedfrom __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
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 create_automl_deployment(self, ac):
analysis_id = "466206000000073001"
model_id = "466206000000073003"
input_table_id = "466206000000061002"
output_table = "SalesDep"
output_columns = ["Sales", "Region"]
prediction_column = "precol"
server_option = 1
import_type = "APPEND"
schedule_details = {
"calendarFrequency": "hourly",
"interval": 3
}
workspace = ac.get_workspace_instance(Config.ORGID, Config.WORKSPACEID)
deployment_info = workspace.create_automl_analysis_deployment(
analysis_id,
model_id,
input_table_id,
output_table,
output_columns,
prediction_column,
server_option,
import_type,
schedule_details
)
print("Deployment Details:", deployment_info)
try:
obj = Sample()
obj.create_automl_deployment(obj.ac)
except Exception as e:
print(str(e))Copiedvar analyticsClient = require('./AnalyticsClient');
var clientId = '';
var clientSecret = '';
var refreshToken = '';
var orgId = '';
var workspaceId = '';
var analysisId = "466206000000073001";
var modelId = "466206000000073003";
var inputTableId = "466206000000061002";
var outputTable = "SalesDep";
var outputColumns = [];
outputColumns.push("Sales");
outputColumns.push("Region");
var predictionColumn = "precol";
var serverOption = 1;
var importType = "APPEND";
var scheduleDetails = {
calendarFrequency: "hourly",
interval: 3
};
var ac = new analyticsClient(clientId, clientSecret, refreshToken);
var workspace = ac.getWorkspaceInstance(orgId, workspaceId);
workspace.createAutomlAnalysisDeployment(
analysisId,
modelId,
inputTableId,
outputTable,
outputColumns,
predictionColumn,
serverOption,
importType,
scheduleDetails
)
.then((response) => {
console.log("Deployment Details:", response);
})
.catch((error) => {
console.log('errorCode : ' + error.errorCode);
console.log('errorMessage : ' + error.errorMessage);
});Copiedrequire 'zoho_analytics_client'
class Config
CLIENT_ID = "1000.xxxxxxx"
CLIENT_SECRET = "xxxxxxx"
REFRESH_TOKEN = "1000.xxxxxxx.xxxxxxx"
ORG_ID = "55522777"
WORKSPACE_ID = "35130000001055707"
end
class Sample
def initialize
@ac = AnalyticsClient.new
.with_data_center("US")
.with_oauth({
"clientId" => Config::CLIENT_ID,
"clientSecret" => Config::CLIENT_SECRET,
"refreshToken" => Config::REFRESH_TOKEN
})
#.with_token_store_path("/home/admin/analytics_ruby_sdk/tokens") # Optional – specify a directory path to securely store the encrypted access token
.build
end
def create_automl_deployment
analysis_id = "466206000000061115"
model_id = "466206000000061119"
input_table_id = "466206000000061002"
output_table = "Sales - Ruby SDk"
output_columns = ["Sales", "Region"]
prediction_column = "precol"
server_option = 1
import_type = "APPEND"
schedule_details = {
"calendarFrequency" => "hourly",
"interval" => 3
}
workspace = @ac.get_workspace_instance(Config::ORG_ID, Config::WORKSPACE_ID)
deployment_info = workspace.create_automl_analysis_deployment(
analysis_id,
model_id,
input_table_id,
output_table,
output_columns,
prediction_column,
server_option,
import_type,
schedule_details
)
puts "Deployment Details:"
puts deployment_info
end
end
begin
obj = Sample.new
obj.create_automl_deployment
rescue ServerError => e
puts "Server Error: #{e.response_content}"
rescue StandardError => e
puts e.message
puts e.backtrace.join("\n")
endDownload SDKs: C# | GO | JAVA | PHP | PYTHON | NodeJS | Ruby
Sample value for CONFIG parameter:
Copied{
"inputTableId": 2531676000011845000,
"outputTable": "SalesAnalysis",
"outputColumns": [
"Sales",
"Product"
],
"predictionColumn": "pred-col",
"serverOption": 1,
"importType": "append",
"scheduleDetails": {
"calendarFrequency": "hourly",
"interval": 3
}
}Sample Response:
CopiedHTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status": "success",
"summary": "Create autoML analysis deployment",
"data": {
"deployments": {
"outputTableId": "466206000000198129",
"deploymentId": "466206000000198176"
}
}
}