Endpoint: /sites/{siteId}/custom-commands

NOTE: Available as of EFT 8.1.0.

This endpoint provides the ability to return a list of custom commands defined on an EFT site or create a new custom command.

  • GET

  • POST

Method & URL

GET https://[server URL]:[port]/admin/v2/sites/{siteId}/custom-commands

GET Body Sample

Copy
###
##Get Site Custom Commands
GET https://{{host}}/admin/v2//sites/{{siteId}}/custom-commands HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}

GET Response Body Sample

Copy
{ "data": [ 
{ "id": "9a0c4aec-862e-4e72-aec4-9b1f04f00bb3", "type": "customCommand", "attributes": 
{ "name": "Command 1" }, "links": { "self": 
"/admin/v2/sites/c7d3ecfe-a100-4bcd-b830-01a10524c048/custom-commands/9a0c4aec-862e-4e72-aec4-9b1f04f00bb3" } }, 
{ "id": "090dde3a-c039-44ab-b03d-5cc994548ce7", "type": "customCommand", "attributes": 
{ "name": "Run to the Moon" }, "links": 
{ "self": "/admin/v2/sites/c7d3ecfe-a100-4bcd-b830-01a10524c048/custom-commands/090dde3a-c039-44ab-b03d-5cc994548ce7" 
} } ], "links": { "self": "/admin/v2/sites/c7d3ecfe-a100-4bcd-b830-01a10524c048/custom-commands" } }

GET PowerShell Sample

Copy
###
#Get Site Custom Commands
Write-Output "Get Site Custom Commands"
Write-Output "-----"
$serverAdminDetails = Invoke-RestMethod -Uri "$baseURL/v2/sites/$siteID/custom-commands" -Method 'GET' -Headers $authHeader
Write-Output $serverAdminDetails | ConvertTo-Json -Depth 10 

Method & URL

POST https://[server URL]:[port]/admin/v2/sites/{siteId}/custom-commands

POST Body Sample

Copy
## Create Custom Command on a specific EFT Site
POST https://{{host}}/admin/v2/sites/{{Siteid}}/custom-commands HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}

{
    "data":{
        "id":"",
        "type": "customCommand",
            "attributes": {
                "enabled": true,
                "name": "Command 5",
                "description": "this is a test to run command 5",
                "executable": "c:\\windows\\system32\\cscript.exe 
                \"c:\\users\\administrator\\desktop\\server.vbs\"",
                "parameters": "",
                "redirectOutputToLog": true,
                "useProcessTimeOut": true,
                "processTimeOut": 30,
                "logFileName": "C:\\ProgramData\\Globalscape\\EFT Server\\Logs\\cmdout.log",
                "redirectOutputToClient": true,
                "useMinNumOfParams": false,
                "minNumOfParams": 1,
                "minNumOfParamsMsg": ""
            }
    }
}
###

POST Response Body Sample

Copy
## Create Custom Command on a specific EFT Site
POST https://{{host}}/admin/v2/sites/{{Siteid}}/custom-commands 
HTTP/1.1
Authorization: EFTAdminAuthToken {{AuthToken}}

{
    "data":{
        "id":"",
        "type": "customCommand",
            "attributes": {
                "enabled": true,
                "name": "Command 5",
                "description": "this is a test to run command 5",
                "executable": "c:\\windows\\system32\\cscript.exe 
                \"c:\\users\\administrator\\desktop\\server.vbs\"",
                "parameters": "",
                "redirectOutputToLog": true,
                "useProcessTimeOut": true,
                "processTimeOut": 30,
                "logFileName": "C:\\ProgramData\\Globalscape\\EFT Server\\
                Logs\\cmdout.log",
                "redirectOutputToClient": true,
                "useMinNumOfParams": false,
                "minNumOfParams": 1,
                "minNumOfParamsMsg": ""
            }
    }
}
###

POST PowerShell Sample

Copy
###
#POST new site Custom Command
Write-Output "POST Custom Command (New Custom Command)"
Write-Output "-----"
$update = 
'{
    "data":{
        "id":"",
        "type": "customCommand",
            "attributes": {
                "enabled": true,
                "name": "Command 5",
                "description": "this is a test to run command 5",
                "executable": "c:\\windows\\system32\\cscript.exe 
                \"c:\\users\\administrator\\desktop\\server.vbs\"",
                "parameters": "",
                "redirectOutputToLog": true,
                "useProcessTimeOut": true,
                "processTimeOut": 30,
                "logFileName": "C:\\ProgramData\\Globalscape\\EFT Server\\Logs\\cmdout.log",
                "redirectOutputToClient": true,
                "useMinNumOfParams": false,
                "minNumOfParams": 1,
                "minNumOfParamsMsg": ""
            }
    }
}'

$update = $update | ConvertFrom-Json
$update = $update | ConvertTo-Json -Depth 10
$patchReturn = Invoke-RestMethod -Uri "$baseURL/v2/sites/$siteID/custom-commands" -Method 'POST' 
-Headers $authHeader -Body $update