You can perform routed file transfer operations from a
collective controller to a collective member or to a registered host
of a collective by invoking REST APIs. The operations include downloading
files from a remote location, uploading files to a remote location,
and deleting files in a remote location. Use the GET, POST,
or DELETE REST APIs. The file transfer operations
occur within an IBM JMX REST Connector.
Procedure
- Optional: To read about the REST APIs, point
a browser at https://controller_host_name:controller_port_name/IBMJMXConnectorREST/api and
enter the controller administrative user ID and password to log in.
The controller must be running to view the REST API documentation.
Alternatively, you can use a collective member host, port, login user
ID and password to view the REST API documentation.
The File
Transfer and Routing sections describe
the APIs used to transfer files between the collective controller
and a member server or a registered host.
The collectiveController-1.0 and collectiveMember-1.0 features
enable the restConnector-1.0 feature, which provides
file transfer capability. Thus, collective controllers and members
do not need to specify restConnector-1.0 in a feature
manager to view the REST APIs or perform file transfer operations.
A stand-alone server configuration might need the restConnector-1.0 feature
to view the REST APIs.
- Unless you work directly with a Liberty
instance, set the routing context as HTTP headers.
- Member server
routing
com.ibm.websphere.jmx.connector.rest.routing.hostName=string
com.ibm.websphere.jmx.connector.rest.routing.serverName=string
com.ibm.websphere.jmx.connector.rest.routing.serverUserDir=string
- Registered host
routing
com.ibm.websphere.jmx.connector.rest.routing.hostName=string
- Ensure the target file is within the configurable read/write
directories of the server for file transfer operations with a member
server, or within configurable read/write directories of the host
for file transfer operations with a registered host.
- Invoke REST APIs that download, upload, or delete files.
{filePath} must be URL-encoded. For routing operations with
registered hosts, {filePath} must be an absolute path and cannot
contain Liberty variables.
- Download one file from a member server or registered host using
the GET operation.
GET https://controller_host:controller_port/IBMJMXConnectorREST/file/{filePath}
- Upload one file to a member server or registered host using the POST operation.
POST https://controller_host:controller_port/IBMJMXConnectorREST/file/{filePath}
- Delete one file from a member server or registered host using
the DELETE operation.
DELETE https://controller_host:controller_port/IBMJMXConnectorREST/file/{filePath}
- Delete multiple files from a member server or registered host
using the POST operation.
POST https://controller_host:controller_port/IBMJMXConnectorREST/file/collection
Example
To download the
myFile.txt file from
the member server
myServerA on the host
myTarget.com with
a user directory of
C:/server/wlp:
- Set the member server routing context as HTTP headers.
com.ibm.websphere.jmx.connector.rest.routing.hostName=myTarget.com
com.ibm.websphere.jmx.connector.rest.routing.serverName=myServerA
com.ibm.websphere.jmx.connector.rest.routing.serverUserDir=C:/server/wlp
- Invoke a GET call to download the file.
GET https://myTarget.com:9443//IBMJMXConnectorREST/file/C%3A%2Ftemp%2FmyFile.txt
To download the
myFile.txt file from
the registered host
myTarget.com:
- Set the registered host routing context as an HTTP header.
com.ibm.websphere.jmx.connector.rest.routing.hostName=myTarget.com
- Invoke a GET call to download the file.
GET https://myTarget.com:9443//IBMJMXConnectorREST/file/C%3A%2Ftemp%2FmyFile.txt
To download the
server.xml file from
the member server
myServerA on the host
myTarget.com with
a user directory of
C:/server/wlp:
- Set the member server routing context as HTTP headers.
com.ibm.websphere.jmx.connector.rest.routing.hostName=myTarget.com
com.ibm.websphere.jmx.connector.rest.routing.serverName=myServerA
com.ibm.websphere.jmx.connector.rest.routing.serverUserDir=C:/server/wlp
- Invoke a GET call to download the ${server.config.dir}/server.xml file.
GET https://myTarget.com:9443//IBMJMXConnectorREST/file/%24{server.config.dir}%2Fserver.xml
What to do next
Get status or details on the REST call. See Getting status on a REST call for multiple registered hosts.