Add a new script to the Script Repository

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

Adds a new script to the Script Repository. Upload the script file first and pass the returned fileID in scriptFile.fileID. The scriptId returned here is the value to use when creating a Custom Script configuration policy with executionType Repository.

Request URL

https://{serverurl}/dcapi/configuration/scriptRepository/script Copied!

Scope

DesktopCentralCloud.Common.CREATECopied!

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Request Parameters

- Request Headers

Content-TypestringMandatory
application/scriptDetails.v1+jsonapplication/scriptDetails.v1+jsonCopied!
AcceptstringMandatory
application/addScriptStatus.v1+jsonapplication/addScriptStatus.v1+jsonCopied!

- Request Body

application/json
JSON Object
Hide Sub-Attributes
scriptFileJSON ObjectMandatory

The uploaded script file to register. Upload the file first (POST /emsapi/files) and pass the returned fileID here.

Show Sub-Attributes
fileIDlongMandatory

Identifier of the uploaded script file. Upload the file first (POST /emsapi/files) and pass the fileID returned by that call.

argumentsstringOptional

Default command-line arguments passed to the script when it runs. Masked in responses.

platformstringOptional

Operating system the script targets. Allowed values:
Windows
Mac
Linux

descriptionstringOptional

Free-text description of what the script does.

exitCodesstringOptional

Comma-separated list of exit codes to treat as success (e.g., "0,1"). Any other exit code marks the execution as failed.

scriptIDstringOptional

Existing script identifier. Omit when adding a new script.

Sample Request

Curl
Java
Python
Deluge
PowerShell
Copied!
curl --request POST \
  --url https://appdomains/dcapi/configuration/scriptRepository/script \
  --header 'Accept: application/addScriptStatus.v1+json' \
  --header 'Authorization: Zoho-oauthtoken  d92d4xxxxxxxxxxxxx15f52' \
  --header 'Content-Type: application/scriptDetails.v1+json' \
  --data '{"scriptFile":{"fileID":12345}}'

Sample Request Body

Add a new Windows script to the repository

Copied!
  {
    "description": "My custom script for deployment",
    "exitCodes": "0",
    "arguments": "--verbose",
    "scriptFile": {
      "fileID": 12345
    },
    "platform": "Windows"
  }
                
▼ Show full

Add a new Linux shell script to the repository. Shows every accepted field; scriptID is omitted because the script does not exist yet.

Copied!
  {
    "description": "Cleanup temporary files on Linux endpoints",
    "exitCodes": "0,1",
    "arguments": "",
    "scriptFile": {
      "fileID": 67890
    },
    "platform": "Linux"
  }
                
▼ Show full

Response Parameters

- HTTP code 200

Response Body - application/json
JSON Object
Hide Sub-Attributes
statusstring

Operation result. Always 'success' on successful script creation

fileNamestring

Final filename of the script (may have suffix if duplicate was found)

scriptIdlong

Unique ID assigned to the newly created script

- HTTP code 401

Response Body - application/json
JSON Object
Hide Sub-Attributes
errorCodelong

Product error code for the authorization failure

errorMsgstring

Localised error message for the error code

- HTTP code 500

Response Body - application/json
JSON Object
Hide Sub-Attributes
errorCodelong

Product error code for the failure

errorMsgstring

Localised error message for the error code

Sample Response: HTTP 200

Script was added to the repository successfully

Copied!
  {
    "fileName": "MyScript.bat",
    "scriptId": 67890,
    "status": "success"
  }
                
▼ Show full

Sample Response: HTTP 401

The API user does not have the role required for this operation

Copied!
  {
    "errorCode": 1001,
    "errorMsg": "Access denied - You are not allowed to access the requested resource."
  }
                
▼ Show full

Sample Response: HTTP 500

Unexpected server error while adding the script

Copied!
  {
    "errorCode": 1003,
    "errorMsg": "An Internal Error occurred, try again later."
  }
                
▼ Show full

Duration: 1 minute | Threshold: 30 | Lock period: 5 minutes

Duration - Time window for the threshold.
Threshold - Number of API calls allowed within the specified duration.
Lock Period - Wait time before consecutive API requests.