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 repository. Validates storage availability, secures filename, checks for duplicates (appends suffix if found), copies the file, generates SHA256 checksums, inserts DB records, and optionally shares the script.

Request URL

https://{server-hostname}:8383/dcapi/configuration/scriptRepository/script

Scope

Common.CREATECopied!

Header

Authorization: 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/scriptDetails.v1+json
JSON object
Hide Sub-Attributes
scriptFileJSON objectMandatory
Show Sub-Attributes
fileIDlongOptional
fileNamestringOptional
customerIDlongOptional
expiryDatestringOptional
fileStatusintegerOptional
uploadIDstringOptional
argumentsstringOptional
platformstringOptional
descriptionstringOptional
exitCodesstringOptional
shareScriptbooleanOptional
scriptIDstringOptional
probeHandlerObjectJSON objectOptional
Show Sub-Attributes
isProbeRequestbooleanOptional
filePathstringOptional
isZiabooleanOptional

Sample Request

Curl
Java
Python
Deluge
PowerShell
Copied!
curl --request POST \
  --url https://appdomain/dcapi/configuration/scriptRepository/script \
  --header 'Accept: application/addScriptStatus.v1+json' \
  --header 'Authorization:  d92d4xxxxxxxxxxxxx15f52' \
  --header 'Content-Type: application/scriptDetails.v1+json' \
  --data '{"description":"My custom script for deployment","exitCodes":"0","arguments":"--verbose","scriptFile":{"fileID":12345},"shareScript":false,"platform":"Windows"}'
Show full

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
    },
    "shareScript": false,
    "platform": "Windows"
  }
                
Show full

Add a new Linux shell script to the repository and share it

Copied!
  {
    "description": "Cleanup temporary files on Linux endpoints",
    "exitCodes": "0,1",
    "arguments": "",
    "scriptFile": {
      "fileID": 67890
    },
    "shareScript": true,
    "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 400

Response Body - application/json
JSON object
Hide Sub-Attributes
errorCodestring

CONFIG_FORM_INPUT_MISSING: a required field is missing from the request

errorMessagestring

Message indicating which input field is missing

- HTTP code 401

Response Body - application/json
JSON object
Hide Sub-Attributes
errorCodestring

UAC_UNAUTHORIZED: user lacks the required role or access to all-customer scripts

errorMessagestring

Authentication or authorization failure reason

- HTTP code 413

Response Body - application/json
JSON object
Hide Sub-Attributes
errorCodestring

SW_INTERNAL_ERROR: insufficient storage to complete the operation

errorMessagestring

Message indicating the server storage is full

- HTTP code 500

Response Body - application/json
JSON object
Hide Sub-Attributes
errorCodestring

INTERNAL_ERROR: unexpected server error during processing

errorMessagestring

Message describing the internal server error

Possible Response Codes

200HTTP code
400HTTP code
401HTTP code
413HTTP code
500HTTP 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 400

File ID is missing from the request body

Copied!
  {
    "errorMessage": "Some input field missing in configuration",
    "errorCode": "CONFIG_FORM_INPUT_MISSING"
  }
                
Show full

Sample Response: HTTP 401

Non-admin user attempted to create an all-customer script

Copied!
  {
    "errorMessage": "Access denied",
    "errorCode": "UAC_UNAUTHORIZED"
  }
                
Show full

Sample Response: HTTP 413

Server does not have enough storage to add the script

Copied!
  {
    "errorMessage": "Storage is full",
    "errorCode": "SW_INTERNAL_ERROR"
  }
                
Show full

Sample Response: HTTP 500

Unexpected server error while adding the script

Copied!
  {
    "errorMessage": "Internal Server Error",
    "errorCode": "INTERNAL_ERROR"
  }
                
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.