Skip to content

CLI ​

11 operations. Call any of them with omada_call_operation (or, in full tool mode, as a tool named by its operationId).

OperationMethodSummary
getCliConfigGETGet the CLI configuration content
modifyCliConfigPATCHModify the CLI configuration content
createCliConfigPOSTCreate a new CLI configuration
getCliDeviceGETGet device list when importing device configuration
getCliDeviceByTypeGETGet device list when creating CLI
deleteCliConfigDELETEDelete the CLI configuration
getCliListGETGet the CLI configuration list
applyCliConfigPOSTApply the CLI configuration
exportCliVariableToFilePOSTExport CLI variable
importCliVariableToFilePOSTImport CLI variable
getModelAndVersionListByTypeGETGet model and version for model CLI.

getCliConfig ​

GET /openapi/v1/{omadacId}/sites/{siteId}/cli/config/cli-type/{cliType}/config-id/{configId}

Get the CLI configuration content

ParameterInTypeRequiredDescription
omadacIdpathstringautoOmada ID (filled in automatically)
siteIdpathstringyesSite ID (site ID or site name)
cliTypepathstringyesCLI type should be a value as follows: 0: site CLI; 1: device CLI; 2:model CLI. Site template only supports site CLI. Site template only supports site CLI.
configIdpathstringyesCLI Config ID
json
// omada_call_operation
{
  "operationId": "getCliConfig",
  "params": {
    "siteId": "<siteId>",
    "cliType": "<cliType>",
    "configId": "<configId>"
  }
}
Details, permissions and error codes

Get the CLI configuration content
The interface requires one of the permissions:
Site Settings Manager View Only
Network Config Page View Only
The possible error code for the interface in the returned body is one of the following error codes (non generic error codes):
-1001 - Invalid request parameters.
-33004 - Operation failed because other operations (site copying, restoring, template synchronizing, etc.) are being performed on this site. Please wait and try again later.

modifyCliConfig ​

PATCH /openapi/v1/{omadacId}/sites/{siteId}/cli/config/cli-type/{cliType}/config-id/{configId}

Modify the CLI configuration content

ParameterInTypeRequiredDescription
omadacIdpathstringautoOmada ID (filled in automatically)
siteIdpathstringyesSite ID (site ID or site name)
cliTypepathstringyesCLI type should be a value as follows: 0: site CLI; 1: device CLI; 2:model CLI. Site template only supports site CLI. Site template only supports site CLI.
configIdpathstringyesCLI Config ID

Request body — application/json (required) — schema ModifyCliOpenApiVO

FieldTypeRequiredDescription
namestringyesCLI configuration name, it should be within the range of 1 - 64 characters
deviceTypestringyesDevice type for CLI configuration application, it should be a value as follows: switch.
descriptionstringnoCLI configuration description, it should be within the range of 0 - 256 characters.
cliConfigstringyesCLI configuration content
devicesarray<DeviceCliVO>noList of devices bound to the CLI configuration.
stacksarray<StackCliVO>noList of stacks bound to the CLI configuration, only device CLI has this field.
modelstringnoDevice model of model cli
modelVersionstringnoDevice model version of model cli
json
// omada_call_operation
{
  "operationId": "modifyCliConfig",
  "params": {
    "siteId": "<siteId>",
    "cliType": "<cliType>",
    "configId": "<configId>"
  },
  "body": "{...}"
}
Details, permissions and error codes

Modify the CLI configuration content
The interface requires one of the permissions:
Site Settings Manager Modify
Network Config Page Modify
The possible error code for the interface in the returned body is one of the following error codes (non generic error codes):
-1001 - Invalid request parameters.
-33004 - Operation failed because other operations (site copying, restoring, template synchronizing, etc.) are being performed on this site. Please wait and try again later.

createCliConfig ​

POST /openapi/v1/{omadacId}/sites/{siteId}/cli/config/cli-type/{cliType}/save

Create a new CLI configuration

ParameterInTypeRequiredDescription
omadacIdpathstringautoOmada ID (filled in automatically)
siteIdpathstringyesSite ID (site ID or site name)
cliTypepathstringyesCLI type should be a value as follows: 0: site CLI; 1: device CLI; 2:model CLI. Site template only supports site CLI. Site template only supports site CLI.

Request body — application/json (required) — schema ModifyCliOpenApiVO

FieldTypeRequiredDescription
namestringyesCLI configuration name, it should be within the range of 1 - 64 characters
deviceTypestringyesDevice type for CLI configuration application, it should be a value as follows: switch.
descriptionstringnoCLI configuration description, it should be within the range of 0 - 256 characters.
cliConfigstringyesCLI configuration content
devicesarray<DeviceCliVO>noList of devices bound to the CLI configuration.
stacksarray<StackCliVO>noList of stacks bound to the CLI configuration, only device CLI has this field.
modelstringnoDevice model of model cli
modelVersionstringnoDevice model version of model cli
json
// omada_call_operation
{
  "operationId": "createCliConfig",
  "params": {
    "siteId": "<siteId>",
    "cliType": "<cliType>"
  },
  "body": "{...}"
}
Details, permissions and error codes

Create a new CLI configuration
The interface requires one of the permissions:
Site Settings Manager Modify
Network Config Page Modify
The possible error code for the interface in the returned body is one of the following error codes (non generic error codes):
-1001 - Invalid request parameters.
-33004 - Operation failed because other operations (site copying, restoring, template synchronizing, etc.) are being performed on this site. Please wait and try again later.

getCliDevice ​

GET /openapi/v1/{omadacId}/sites/{siteId}/cli/config/devices

Get device list when importing device configuration

ParameterInTypeRequiredDescription
omadacIdpathstringautoOmada ID (filled in automatically)
siteIdpathstringyesSite ID (site ID or site name)
json
// omada_call_operation
{
  "operationId": "getCliDevice",
  "params": {
    "siteId": "<siteId>"
  }
}
Details, permissions and error codes

Get device list when importing device configuration
The interface requires one of the permissions:
Site Settings Manager View Only
Network Config Page View Only

getCliDeviceByType ​

GET /openapi/v1/{omadacId}/sites/{siteId}/cli/config/devices/device-type/{deviceType}

Get device list when creating CLI

ParameterInTypeRequiredDescription
omadacIdpathstringautoOmada ID (filled in automatically)
siteIdpathstringyesSite ID (site ID or site name)
deviceTypepathstringyesDevice Type. Supported type: switch.
json
// omada_call_operation
{
  "operationId": "getCliDeviceByType",
  "params": {
    "siteId": "<siteId>",
    "deviceType": "<deviceType>"
  }
}
Details, permissions and error codes

Get device list when creating CLI
The interface requires one of the permissions:
Site Settings Manager View Only
Network Config Page View Only
The possible error code for the interface in the returned body is one of the following error codes (non generic error codes):
-1001 - Invalid request parameters.

deleteCliConfig ​

DELETE /openapi/v1/{omadacId}/sites/{siteId}/cli/configs/cli-type/{cliType}

Delete the CLI configuration

ParameterInTypeRequiredDescription
omadacIdpathstringautoOmada ID (filled in automatically)
siteIdpathstringyesSite ID (site ID or site name)
cliTypepathstringyesCLI type should be a value as follows: 0: site CLI; 1: device CLI; 2:model CLI. Site template only supports site CLI. Site template only supports site CLI.

Request body — application/json (required) — schema DeleteCliOpenApiVO

FieldTypeRequiredDescription
configIdsarray<string>noList of IDs to be deleted.
json
// omada_call_operation
{
  "operationId": "deleteCliConfig",
  "params": {
    "siteId": "<siteId>",
    "cliType": "<cliType>"
  },
  "body": "{...}"
}
Details, permissions and error codes

Delete the CLI configuration
The interface requires one of the permissions:
Site Settings Manager Modify
Network Config Page Modify
The possible error code for the interface in the returned body is one of the following error codes (non generic error codes):
-1001 - Invalid request parameters.
-33004 - Operation failed because other operations (site copying, restoring, template synchronizing, etc.) are being performed on this site. Please wait and try again later.

getCliList ​

GET /openapi/v1/{omadacId}/sites/{siteId}/cli/configs/cli-type/{cliType}/device-type/{deviceType}

Get the CLI configuration list

ParameterInTypeRequiredDescription
omadacIdpathstringautoOmada ID (filled in automatically)
siteIdpathstringyesSite ID (site ID or site name)
cliTypepathstringyesCLI type should be a value as follows: 0: site CLI; 1: device CLI; 2:model CLI. Site template only supports site CLI. Site template only supports site CLI.
deviceTypepathstringyesDevice Type. Supported type: switch.
pagequeryintegernoStart page number. Start from 1. (default 1)
pageSizequeryintegernoNumber of entries per page. It should be within the range of 1–1000. (default 100)
json
// omada_call_operation
{
  "operationId": "getCliList",
  "params": {
    "siteId": "<siteId>",
    "cliType": "<cliType>",
    "deviceType": "<deviceType>"
  }
}
Details, permissions and error codes

Get the CLI configuration list
The interface requires one of the permissions:
Site Settings Manager View Only
Network Config Page View Only
The possible error code for the interface in the returned body is one of the following error codes (non generic error codes):
-1001 - Invalid request parameters.
-33004 - Operation failed because other operations (site copying, restoring, template synchronizing, etc.) are being performed on this site. Please wait and try again later.

applyCliConfig ​

POST /openapi/v1/{omadacId}/sites/{siteId}/cli/configs/config-id/{configId}/apply

Apply the CLI configuration

ParameterInTypeRequiredDescription
omadacIdpathstringautoOmada ID (filled in automatically)
siteIdpathstringyesSite ID (site ID or site name)
configIdpathstringyesCLI Config ID
json
// omada_call_operation
{
  "operationId": "applyCliConfig",
  "params": {
    "siteId": "<siteId>",
    "configId": "<configId>"
  }
}
Details, permissions and error codes

Apply the CLI configuration
The interface requires one of the permissions:
Site Settings Manager Modify
Network Config Page Modify
The possible error code for the interface in the returned body is one of the following error codes (non generic error codes):
-1001 - Invalid request parameters.
-33004 - Operation failed because other operations (site copying, restoring, template synchronizing, etc.) are being performed on this site. Please wait and try again later.
-39051 - Operation failed. Please try again later.

exportCliVariableToFile ​

POST /openapi/v1/{omadacId}/sites/{siteId}/cli/export/variable

Export CLI variable

ParameterInTypeRequiredDescription
omadacIdpathstringautoOmada ID (filled in automatically)
siteIdpathstringyesSite ID (site ID or site name)

Request body — application/json (required) — schema ExportCliVarOpenApiVO

FieldTypeRequiredDescription
typeintegeryesExport type should be a value as follows: 0:CSV; 1:JSON
devicesarray<DeviceExportCliVO>yesDevices
json
// omada_call_operation
{
  "operationId": "exportCliVariableToFile",
  "params": {
    "siteId": "<siteId>"
  },
  "body": "{...}"
}
Details, permissions and error codes

Export CLI variable,filename is a UTF-8 string encoded by URL Encoder
The interface requires one of the permissions:
Site Settings Manager View Only
Network Config Page View Only
The possible error code for the interface in the returned body is one of the following error codes (non generic error codes):
-1001 - Invalid request parameters.
-1004 - Invalid request type.
-33000 - This site does not exist.
-33713 - Failed to process the files.

importCliVariableToFile ​

POST /openapi/v1/{omadacId}/sites/{siteId}/cli/import/variable

Import CLI variable

ParameterInTypeRequiredDescription
omadacIdpathstringautoOmada ID (filled in automatically)
siteIdpathstringyesSite ID (site ID or site name)

Request body — application/json (optional)

FieldTypeRequiredDescription
filestring (binary)yesFile must be a file in .csv or .json form
json
// omada_call_operation
{
  "operationId": "importCliVariableToFile",
  "params": {
    "siteId": "<siteId>"
  },
  "body": "{...}"
}
Details, permissions and error codes

Import CLI variable
The interface requires one of the permissions:
Site Settings Manager View Only
Network Config Page View Only
The possible error code for the interface in the returned body is one of the following error codes (non generic error codes):
-1001 - Invalid request parameters.
-1004 - Invalid request type.
-1005 - Operation forbidden.
-30306 - Invalid files.
-33713 - Failed to process the files.
-42003 - This operator does not exist.
-42006 - Failed to log in.

getModelAndVersionListByType ​

GET /openapi/v1/{omadacId}/sites/{siteId}/cli/models/device-type/{deviceType}

Get model and version for model CLI.

ParameterInTypeRequiredDescription
omadacIdpathstringautoOmada ID (filled in automatically)
siteIdpathstringyesSite ID (site ID or site name)
deviceTypepathstringyesDevice Type. Supported type: switch.
json
// omada_call_operation
{
  "operationId": "getModelAndVersionListByType",
  "params": {
    "siteId": "<siteId>",
    "deviceType": "<deviceType>"
  }
}
Details, permissions and error codes

Get model and version for model CLI.
The interface requires one of the permissions:
Site Settings Manager View Only
Network Config Page View Only
The possible error code for the interface in the returned body is one of the following error codes (non generic error codes):
-1001 - Invalid request parameters.

Released under the MIT License. Not affiliated with or endorsed by TP-Link.