The create a custom PowerShell action operation will add a PowerShell action to a self service product with the specified body content.
Request
Request URI
Method | Request URI |
---|---|
POST | https://{company-name}.helloid.com/api/v1/selfservice/products/{productGUID}/powershellaction |
POST | https://{company-name}.helloid.com/api/v1/selfservice/products/{productCode}/powershellaction |
Request parameters
Parameter | Description |
---|---|
{company-name} | The company name of the target company |
{productGUID} | The GUID for the self service product |
{productCode} | The product code for the self service product |
Request headers
Header | Description |
---|---|
Content-Type | Required. Must be set to application/json. |
Sample request body
{ "executeOnState": 1, "variables": [ { "name": "powerShellScriptGuid", "value": "280ba813-2e12-489c-9d2a-761fa8503851", "typeConstraint": "string", "secure": false }, { "name": "useTemplate", "value": "true", "typeConstraint": "boolean", "secure": false }, { "name": "powerShellScript", "value": null, "typeConstraint": "string", "secure": false }, { "name": "var1", "value": "Variable1", "typeConstraint": "string", "secure": false, "isScriptVariable": true }, { "name": "var2", "value": "Variable2", "typeConstraint": "string", "secure": false, "isScriptVariable": true } ] }
Request body parameters
Parameter | Description | Required/Optional | Default value |
---|---|---|---|
executeOnState | Indicates in which state the PowerShell action will trigger. Possible values: 1. RequestCreated (default) 2. RequestCreateCompleted 3. RequestApproved 4. RequestApproveCompleted 5. RequestDenied 6. RequestDenyCompleted 7. RequestDeleted 8. RequestDeleteCompleted 9. RequestRevoked 10. RequestRevokeCompleted 11. RequestReturned 12. RequestReturnCompleted |
Optional | 1 |
variables/useTemplate | Indicates if an existing PowerShell script should be used. To be used together with a valid 'variables/powerShellScriptGuid' parameter | Optional | false |
variables/powerShellScriptGuid | GUID of an existing PowerShell script. To be used together with 'variables/useTemplate' = true | Optional | - |
variables/powerShellScript | The PowerShell script to use. To be used together with 'variables/useTemplate' = false | Optional | - |
Variables for PowerShell | To be used in the PowerShell script, make sure to set isScriptVariable = true | Optional | - |
Response
Response status
Code | Description |
---|---|
200(OK) | Indicates that the operation was successful and the resource is created. |
400(BAD REQUEST) | Indicates that the operation was not successful. The content type was incorrect or the request body was malformed. |
401(UNAUTHORIZED) | Indicates that no authentication header was given or the api key and secret were invalid. If the api key and secret were valid check the configuration in your portal, it is possibilty these were IP restricted or are disabled. |
409(CONFLICT) | Indicates that the operation was not successful. If there were validation errors, the response will include an error result. |
Please also see error result.
Please also see common HTTP status codes.
Sample response body
{ "actionGUID": "7cf7bf84-5e36-4d64-b8af-5e42ed39c424", "name": "Custom PowerShell script", "options": 1, "objectGUID": "87ed7ecc-0ee7-4d9c-a718-341d2f6861fe", "executeOnState": 1, "automationStoreTaskId": "4d20769f-80f1-48f6-acd1-33e642aa211d", "automationStoreTaskVersion": "1.0.0", "executionType": "native", "executionEntry": "powershell-script", "executionEnvironment": "helloid-agent", "executionMinimumVersion": "1.1.0", "variables": [ { "id": "55d7ffa4-2db4-4236-9363-5dd58dd834b8", "name": "powerShellScript", "value": null, "typeConstraint": "string", "secure": false, "isScriptVariable": false }, { "id": "d5335bc8-b8f1-4c48-9ace-6328f8c520f9", "name": "powerShellScriptGuid", "value": "280ba813-2e12-489c-9d2a-761fa8503851", "typeConstraint": "string", "secure": false, "isScriptVariable": false }, { "id": "6d715dee-7111-4095-ac3c-383f2c364256", "name": "useTemplate", "value": "true", "typeConstraint": "boolean", "secure": false, "isScriptVariable": false }, { "id": "903e39e1-2cd3-46e8-81d9-d8b9e1c1e956", "name": "var1", "value": "Variable1", "typeConstraint": "string", "secure": false, "isScriptVariable": false }, { "id": "82432482-79ce-4b5a-a7ff-4ccf858dd295", "name": "var2", "value": "Variable2", "typeConstraint": "string", "secure": false, "isScriptVariable": false } ] }
Example request with cURL
Replace placeholder values surrounded by {
}
with the actual values.
curl -u {api-key}:{api-secret} -X POST https://{company-name}.helloid.com/api/v1/selfservice/products/{productGUID}/powershellaction -H "Content-Type:application/json" -d
'{
[request body here]
}