Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
in CompleteFTP by (310 points)
Is it possible to change the output format for Custom Commands?

The documentation indicates that for web invocations it is returned in JSON format. Is it possible to give an option (maybe based on the Content-Type header) to return as a string or in the same format the SSH commands are returned as?


Use case:

I have a function that returns an XML string. The web invocation of the custom commands seems to be returning it wrapped in a JSON object

1 Answer

0 votes
by (46.8k points)

Unfortunately version 12.X doesn't support formats other than JSON when custom commands are invoked in this way, but there is a way to do it.

What you can do is create a JSS web app that calls your custom command and returns a value in any format you like.  To try this do the following:

  1. Add a Windows folder called 'Test' underneath the /Public folder in the virtual file-system.
  2. Set the owner to 'web' (since the web user has JSS enabled).
  3. Use a text editor to create a file called test.jss and save it in the Windows folder to which /Public/Test is mapped (probably C:\ProgramData\Enterprise Distributed Technologies\Complete FTP\Public\Test).
  4. Copy the code below into the JSS file and replace 'myFunction' with the name of your function.
  5. Save the file.
  6. Open the following URL in your browser: https://localhost/Test/test.jss.  You should see the XML that your function returned.


response.contentType = "application/xml";

Note that, since the /Public/Test folder doesn't give permissions to 'All users', you'll need to be logged in to be able to call the function.  If you'd like provide public access then just grant 'Download' permission for 'All users' for that folder in the Folders panel.