Example: Querying multiple file transfers using an HTTP request

You can query the status of multiple file transfers by submitting a request through the WebSphere® MQ File Transfer Edition Web Gateway. The Web Gateway returns information in either XML or JSON format that describes the status of the transfers that match the query.

About this task

You can create a URI query that requests transfer information for all transfers that match the query. You can query transfers by their associated details, including the source agent, the destination agent, the source file, the destination file, the transfer status, the metadata, the transfer start time, the transfer end time, and the job name. You can sort the transfer information that is returned by agent, status, start time, end time, or job name, and you can specify the number of results to return. A successful request returns an HTTP status code of 200 and a payload that describes the status of the transfers that match the query.

The following steps describe how to submit a request. In this example, the server hosting the WebSphere MQ File Transfer Edition Web Gateway is example.com. The query requests information that fulfills the following criteria:
  • It is from transfers that completed before 1pm UTC on Thursday 26th August 2010, specified by the endbefore=2010-08-26T13:00:00 query
  • It is from transfers that have AGENT_TITAN as either the source agent or destination agent, specified by the agent=AGENT_TITAN query
  • It is sorted by job name in ascending order, specified by the sortby=jobname and sort=ascending queries
  • It includes only the first three transfers that match the full query, specified by the count=3 query
  • It is returned in JSON format, specified by the Accept: application/json header.
For more information about query parameters, see Query parameters. For more information about the parameters used to sort the results, see Result format parameters.

The following steps describe how to submit a request. In this example, the server hosting the WebSphere MQ File Transfer Edition Web Gateway is example.com and the HTTP request is submitted using a web browser which identifies itself as mozilla.

Procedure

  1. Create an HTTP request with the following format:
    GET HTTP/1.1 /transfer/?endbefore=2010-08-26T13:00:00&agent=AGENT_TITAN
                                &sortby=jobname&sort=ascending&count=3
    Host: example.com
    User-Agent: mozilla
    Accept: application/json
  2. Submit the request to the Web Gateway. The Web Gateway returns an HTTP response with the following format:
    {
    
       "transfers" : {
    
          "transfer" : {
             "end-time" : "2010-08-23T14:13:03.260Z",
             "status" : "Complete",
             "start-time" : "2010-08-23T14:12:39.076Z",
             "id" : "414d51205745422e4654452020202020c1a1a34b03720120",
             "result" : {
                "code" : "0",
                "text" : "BFGRP0032I: The file transfer request has successfully completed."
             }
             ,
             "destination" : {
    
                "metadata" : {
    
                   "key" : [
                      {
                         "name" : "com.ibm.wmqfte.JobName",
                         "value" : "ALPHA"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.SourceAgent",
                         "value" : "AGENT_TITAN"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.DestinationAgent",
                         "value" : "AGENT_MIMAS"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.MqmdUser",
                         "value" : "rich"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingHost",
                         "value" : "iceman.example.com."
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingUser",
                         "value" : "rich"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.TransferId",
                         "value" : "414d51205745422e4654452020202020c1a1a34b03720120"
                      }
    
                   ]
                }
                ,
                "agent" : {
                   "name" : "AGENT_MIMAS",
                   "qmgr" : "QM_SATURN"
                }
             }
             ,
             "stats" : {
                "bytes-transferred" : "259354303",
                "retry-count" : "0",
                "file-warnings" : "0",
                "file-failures" : "0"
             }
             ,
             "transfer-set" : {
    
                "file" : {
                   "result-code" : "0",
                   "mode" : "text",
                   "source-file" : {
                      "name" : "\/home\/rich\/file.zip",
                      "attribute-values" : {
                         "last-modified" : "2010-08-19T14:16:57.000Z",
                         "checksum-value" : "98611a272a27d373f92d73a08cf0d4f4",
                         "checksum-method" : "MD5",
                         "file-size" : "259354303",
                         "disposition" : "leave"
                      }
                   }
                   ,
                   "destination-file" : {
                      "name" : "\/tmp\/file.zip",
                      "attribute-values" : {
                         "exists-action" : "error",
                         "last-modified" : "2010-08-23T14:13:02.000Z",
                         "checksum-value" : "98611a272a27d373f92d73a08cf0d4f4",
                         "checksum-method" : "MD5",
                         "file-size" : "259354303"
                      }
                   }
                }
             }
             ,
             "source" : {
    
                "metadata" : {
    
                   "key" : [
                      {
                         "name" : "com.ibm.wmqfte.JobName",
                         "value" : "ALPHA"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.SourceAgent",
                         "value" : "AGENT_TITAN"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.DestinationAgent",
                         "value" : "AGENT_MIMAS"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingHost",
                         "value" : "iceman.example.com."
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.MqmdUser",
                         "value" : "rich"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.TransferId",
                         "value" : "414d51205745422e4654452020202020c1a1a34b03720120"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingUser",
                         "value" : "rich"
                      }
    
                   ]
                }
                ,
                "agent" : {
                   "name" : "AGENT_TITAN",
                   "qmgr" : "QM_SATURN"
                }
             }
          }
       }
    
    "transfer" : {
             "end-time" : "2010-08-25T15:20:03.260Z",
             "status" : "Complete",
             "start-time" : "2010-08-25T15:19:39.076Z",
             "id" : "414d51205745422e4654452020202020c1a1a34b03720120",
             "result" : {
                "code" : "0",
                "text" : "BFGRP0032I: The file transfer request has successfully completed."
             }
             ,
             "destination" : {
    
                "metadata" : {
    
                   "key" : [
                      {
                         "name" : "com.ibm.wmqfte.JobName",
                         "value" : "BRAVO"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.SourceAgent",
                         "value" : "AGENT_RHEA"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.DestinationAgent",
                         "value" : "AGENT_TITAN"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.MqmdUser",
                         "value" : "rich"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingHost",
                         "value" : "iceman.example.com."
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingUser",
                         "value" : "rich"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.TransferId",
                         "value" : "414d51205745422e4654452020202020c1a1a34b03720120"
                      }
    
                   ]
                }
                ,
                "agent" : {
                   "name" : "AGENT_TITAN",
                   "qmgr" : "QM_SATURN"
                }
             }
             ,
             "stats" : {
                "bytes-transferred" : "259354303",
                "retry-count" : "0",
                "file-warnings" : "0",
                "file-failures" : "0"
             }
             ,
             "transfer-set" : {
    
                "file" : {
                   "result-code" : "0",
                   "mode" : "text",
                   "source-file" : {
                      "name" : "\/home\/rich\/file2.zip",
                      "attribute-values" : {
                         "last-modified" : "2010-08-19T14:16:57.000Z",
                         "checksum-value" : "98611a272a27d373f92d73a08cf0d4f4",
                         "checksum-method" : "MD5",
                         "file-size" : "259354303",
                         "disposition" : "leave"
                      }
                   }
                   ,
                   "destination-file" : {
                      "name" : "\/tmp\/file2.zip",
                      "attribute-values" : {
                         "exists-action" : "error",
                         "last-modified" : "2010-08-25T15:120:02.000Z",
                         "checksum-value" : "98611a272a27d373f92d73a08cf0d4f4",
                         "checksum-method" : "MD5",
                         "file-size" : "259354303"
                      }
                   }
                }
             }
             ,
             "source" : {
    
                "metadata" : {
    
                   "key" : [
                      {
                         "name" : "com.ibm.wmqfte.JobName",
                         "value" : "BRAVO"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.SourceAgent",
                         "value" : "AGENT_RHEA"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.DestinationAgent",
                         "value" : "AGENT_TITAN"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingHost",
                         "value" : "iceman.example.com."
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.MqmdUser",
                         "value" : "rich"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.TransferId",
                         "value" : "414d51205745422e4654452020202020c1a1a34b03720120"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingUser",
                         "value" : "rich"
                      }
    
                   ]
                }
                ,
                "agent" : {
                   "name" : "AGENT_RHEA",
                   "qmgr" : "QM_SATURN"
                }
             }
          }
       }
    "transfer" : {
             "end-time" : "2010-08-21T14:13:03.260Z",
             "status" : "Complete",
             "start-time" : "2010-08-21T14:12:39.076Z",
             "id" : "414d51205745422e4654452020202020c1a1a34b03720120",
             "result" : {
                "code" : "0",
                "text" : "BFGRP0032I: The file transfer request has successfully completed."
             }
             ,
             "destination" : {
    
                "metadata" : {
    
                   "key" : [
                      {
                         "name" : "com.ibm.wmqfte.JobName",
                         "value" : "CHARLIE"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.SourceAgent",
                         "value" : "AGENT_TITAN"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.DestinationAgent",
                         "value" : "AGENT_DIONE"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.MqmdUser",
                         "value" : "rich"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingHost",
                         "value" : "iceman.example.com."
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingUser",
                         "value" : "rich"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.TransferId",
                         "value" : "414d51205745422e4654452020202020c1a1a34b03720120"
                      }
    
                   ]
                }
                ,
                "agent" : {
                   "name" : "AGENT_DIONE",
                   "qmgr" : "QM_SATURN"
                }
             }
             ,
             "stats" : {
                "bytes-transferred" : "259354303",
                "retry-count" : "0",
                "file-warnings" : "0",
                "file-failures" : "0"
             }
             ,
             "transfer-set" : {
    
                "file" : {
                   "result-code" : "0",
                   "mode" : "text",
                   "source-file" : {
                      "name" : "\/home\/rich\/file3.zip",
                      "attribute-values" : {
                         "last-modified" : "2010-08-19T14:16:57.000Z",
                         "checksum-value" : "98611a272a27d373f92d73a08cf0d4f4",
                         "checksum-method" : "MD5",
                         "file-size" : "259354303",
                         "disposition" : "leave"
                      }
                   }
                   ,
                   "destination-file" : {
                      "name" : "\/tmp\/file3.zip",
                      "attribute-values" : {
                         "exists-action" : "error",
                         "last-modified" : "2010-08-21T14:13:02.000Z",
                         "checksum-value" : "98611a272a27d373f92d73a08cf0d4f4",
                         "checksum-method" : "MD5",
                         "file-size" : "259354303"
                      }
                   }
                }
             }
             ,
             "source" : {
    
                "metadata" : {
    
                   "key" : [
                      {
                         "name" : "com.ibm.wmqfte.JobName",
                         "value" : "CHARLIE"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.SourceAgent",
                         "value" : "AGENT_TITAN"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.DestinationAgent",
                         "value" : "AGENT_DIONE"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingHost",
                         "value" : "iceman.example.com."
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.MqmdUser",
                         "value" : "rich"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.TransferId",
                         "value" : "414d51205745422e4654452020202020c1a1a34b03720120"
                      }
                      ,
                      {
                         "name" : "com.ibm.wmqfte.OriginatingUser",
                         "value" : "rich"
                      }
    
                   ]
                }
                ,
                "agent" : {
                   "name" : "AGENT_TITAN",
                   "qmgr" : "QM_SATURN"
                }
             }
          }
       }
    }

Task Task

Feedback

Timestamp icon Last updated: Tuesday, 30 January 2018
http://www.ibm.com/support/knowledgecenter/SSEP7X_7.0.4/com.ibm.wmqfte.doc/web_query_transfer.htm