Replace the file content of an existing script

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

Replaces the file associated with an existing script. Upload the replacement file first and pass the returned fileID in this request.

Request URL

https://{serverurl}/dcapi/configuration/scriptRepository/{scriptId}/file Copied!

Scope

DesktopCentralCloud.Common.CREATECopied!

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Request Parameters

- Request Headers

Content-TypestringMandatory
application/scriptFileDetails.v1+jsonapplication/scriptFileDetails.v1+jsonCopied!
AcceptstringMandatory
application/updateScriptFileStatus.v1+jsonapplication/updateScriptFileStatus.v1+jsonCopied!

- Path Parameters

scriptIdstringMandatory

Unique identifier of the script whose file content is replaced. Fetch from List Scripts.

- Request Body

application/json
JSON Object
Hide Sub-Attributes
contentstringMandatory

New content of the script file, as plain text.

fileNamestringMandatory

Name of the script file, including its extension.

Sample Request

Curl
Java
Python
Deluge
PowerShell
Copied!
curl --request PUT \
  --url https://appdomains/dcapi/configuration/scriptRepository/{scriptId}/file \
  --header 'Accept: application/updateScriptFileStatus.v1+json' \
  --header 'Authorization: Zoho-oauthtoken  d92d4xxxxxxxxxxxxx15f52' \
  --header 'Content-Type: application/scriptFileDetails.v1+json' \
  --data '{"fileName":"MyScript.sh","content":"#!/bin/bash\necho '\''Hello World'\''\nexit 0"}'

Sample Request Body

Replace the content of a Linux shell script

Copied!
  {
    "fileName": "MyScript.sh",
    "content": "#!/bin/bash\necho 'Hello World'\nexit 0"
  }
                
▼ Show full

Replace the content of a Windows batch script

Copied!
  {
    "fileName": "Cleanup.bat",
    "content": "@echo off\necho Running cleanup...\ndel /q C:\\Temp\\*.tmp\nexit /b 0"
  }
                
▼ Show full

Response Parameters

- HTTP code 200

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

false when the user does not have permission to modify the script file

accessDeniedReasonstring

Reason for access denial. Allowed values:
createdByDifferentUser
otherCustomerScript

- 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

User does not have permission to modify this script file

Copied!
  {
    "allowAccess": false
  }
                
▼ 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 modifying script file content

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

Duration: 1 minute | Threshold: 20 | 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.