Getting started with the REST API for MFT

Get started quickly with the administrative REST API for Managed File Transfer and try out a few example requests to view the MFT agent status, and to view a list of transfers.

Before you begin

  • The examples use cURL to send REST requests to view a list of transfers and view MFT agent status. Therefore, to complete this task you need cURL installed on your system.
  • To complete this task, you must be a user with certain privileges so that you can use the dspmqweb command:
    • [z/OS]On z/OS®, you must have authority to run the dspmqweb command, and write access to the mqwebuser.xml file.
    • [UNIX, Linux, Windows, IBM i]On all other operating systems, you must be a privileged user.

Procedure

  1. Ensure that the mqweb server is configured for the administrative REST API for MFT:
    • If the mqweb server is not already configured for use by the administrative REST API, the administrative REST API for MFT, the messaging REST API, or IBM® MQ Console, configure the mqweb server.For more information about creating a basic configuration for the mqweb server with a basic registry, see Basic configuration for the mqweb server.
    • If the mqweb server is configured, ensure that step 8 of Basic configuration for the mqweb server was completed to enable the administrative REST API for MFT.
  2. [z/OS] On z/OS, set the WLP_USER_DIR environment variable so that you can use the dspmqweb command. Set the variable to point to your mqweb server configuration by entering the following command:
    export WLP_USER_DIR=WLP_user_directory
    where WLP_user_directory is the name of the directory that is passed to crtmqweb. For example:
    export WLP_USER_DIR=/var/mqm/web/installation1

    For more information, see Creating the mqweb server.

  3. Determine the REST API URL by entering the following command:
    dspmqweb status
    The examples in the following steps assume that your REST API URL is the default URL https://localhost:9443/ibmmq/rest/v1/. If your URL is different than the default, substitute your URL in the following steps.
  4. Make a GET request on the agent resource to return basic details about all agents, including the name, type and state:
    curl -k https://localhost:9443/ibmmq/rest/v2/admin/mft/agent/ -X GET -u mftadmin:mftadmin
  5. Create some transfers to display by using the fteCreateTransfer command.

    The mqweb server caches information about transfers and returns this information when a request is made. This cache is reset when the mqweb server is restarted. You can see whether the server was restarted by viewing the console.log and messages.log files, or on z/OS, looking at the output from the started task.

  6. Make a GET request on the transfer resource to return details of up to four transfers that were made since the mqweb server was started:
    curl -k https://localhost:9443/ibmmq/rest/v2/admin/mft/transfer?limit=4 -X GET -u mftadmin:mftadmin

What to do next