API scriptsGet more from your EFT Server
APIs can be used for every feature of the software and called as a part of the script. That might be to enable scripting of some basic admin functions such as user creation, or more complicated activities such as creating file structures and shared folders.
API calls can also be used to get information out of the system. Some examples include:
- The number of Workspaces licences in use by a specific group of users.
- A list of all users, when they logged in and even if their password has expired.
All this information is available through the console app but cannot be compiled in a simple list.
The easiest way to do this is to install the EFT console onto that machine (from the EFT installer that you used to install your main server).
Finally, you will need to enable COM access for an Admin user (managed through the EFT console via the Administration tab of the server).
Although the syntax of commands may alter between scripting languages, every script needs to declare connection information via a COM object. For example, a typical opening section of a VB Script may include the following lines:
CRLF = (Chr(13)& Chr(10))
txtPort = “1111”
txtAdminUserName = “API”
txtPassword = “A1bC3d$E5”
<- Put your Admin port here
<- This is the user name
<- This is the user password
Set objFile = objFSO.CreateTextFile(outFile,True)
objFile.Write “There are a maximum of ” & SFTPServer.WSSeatsMax & ” seats available.” & vbCrLf
objFile.Write “There are ” & SFTPServer.WSSeatsUsed & ” seats in use” & vbCrLf
objFile.Write “That leaves ” & Seatsleft & ” seats unused” & vbCrLf
This will output a string to a file which would look similar to this.
There are a maximum of 25 seats available
There are 8 seats in use
That leaves 17 seats unused
Automating the script
If you are using Powershell then you would create a custom command to call powershell.exe
Our definition of the cScript command in our EFT looks like this and allows a filename to be passed to the script as well.
In our Event rule, the output file is emailed to a user as an attachment.
Need help or short of time?
- A full list of all functions and API commands is available online at https://help.globalscape.com/help/gs_com_api/
- Sample scripts are available to download at https://help.globalscape.com/help/gs_com_api/#t=COM_Script_Examples.htm
- Help with creating custom commands can be found at https://help.globalscape.com/help/eft7-4/#t=mergedProjects%2Fcommands%2FCustom_Commands.htm