Platform O&M/Automated O&M/Script Library
POSTScript LibrarySince 5.2.0SynchronousAuth Required
CreateGuestVmScript
CreateGuestVmScript
Execution Availability
Try It Out
Submit a mock request using the current auth context and example-driven inputs.
Request Inputs
Body Fields
paramsObjectRequiredRequest body parameter object.
nameStringRequiredThe resource name.
descriptionStringOptional. Optional. The detailed description of the resource.
scriptContentStringRequiredThe script content.
renderParamsStringOptional. The custom parameters.
platformStringRequiredThe platform.
scriptTypeStringRequiredThe script type.
scriptTimeoutintOptional. The timeout period.
resourceUuidStringOptional. The resource UUID.
tagUuidsListOptional. The tag UUID list.
systemTagsListOptional. The system tags.
userTagsListOptional. The user tags.
Responses
Endpoint
POST/zstack/v1/scripts
/zstack/v1/scripts
Request Example
curl -X POST 'http://{host}/zstack/v1/scripts' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"params":{"name":"<name>","description":"<description>","scriptContent":"<scriptContent>","renderParams":"<renderParams>","platform":"<platform>","scriptType":"<scriptType>","scriptTimeout":1,"resourceUuid":"<resourceUuid>","tagUuids":["<tagUuids>"]},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'
Response Example
200{ "inventory": { "uuid": "a90f02b86916371a87bb5f2716dbfc0c", "name": "script1", "description": "this is a script", "scriptContent": "echo helloworld", "renderParams": "[{\"key\":\"key\",\"value\":\"value\",\"description\":\"description\"}]", "platform": "Linux", "scriptType": "Shell", "scriptTimeout": 30, "createDate": "Sep 23, 2024 11:53:59 AM", "lastOpDate": "Sep 23, 2024 11:53:59 AM" } }Change History
This API has no change history records yet.
