Run the Web Services from a Client Application

This section provides the following:

  • Demonstrate how to use the SWS V2 from client applications.
  • Provide a step-by-step approach to integrate the SWS V2 web services in the client applications.
  • Demonstrate the following scenarios.
Scenario Web Service Used
Generate a report about files known to the Tertiary Storage Manager

fsfileinfo

Generate a report about the policy class associated with directory.

fsdirclass

Generate a report about storage manager policies.

fsclassinfo

Expedite the storage of a file that currently resides on disk to media.

fsstore

Remove the copy of a file from disk after the file was stored to a medium.

fsrmdiskcopy

Retrieve or recover files from media and place on disk.

fsretrieve

Create a directory quota on a managed file system.

snquota

Set the quota limits for the directory.
List all available quotas on a file system.
  • Provide samples on how to asynchronously execute web services calls in SWS V2.
  • Demonstrate how to use web services for object storage activities.
  • SWS V2 web services supports several software languages; this section also demonstrates how to use the web services in customer applications written in Java, Perl and Python.

Java

The example below uses the Jersey library. Download the latest version of Jersey library online at: https://jersey.java.net/download.html.

In the following example, a file info call is performed, similar to the example illustrated in the section Run the Web Services.

// Get the client configuration

ClientConfig config = getClientConfig();

       

// Setup SSL for https connection

setupSSL(useHttps, config);

       

// Configure the client

Client client = configureClient(userName, password, config);

       

// Create the service

WebResource service = client.resource(getBaseURI(hostName, port, useHttps));

       

// Obtain the right media type based on the format requested by the user

String mediaType = getMediaType(format);

 

// Invoke the web service and obtain the response back as a String

String response = service.path("sws/v2/file/fsfileinfo")

                                    .queryParam("file", filePath)

                                    .queryParam("format", format)

                                    .accept(mediaType).get(String.class);

First, get the client configuration.

private ClientConfig getClientConfig() {

        ClientConfig config = new DefaultClientConfig();

        return config;

}

Now, configure for an https request. The code is optional and only required if https is the protocol.

private void setupSSL(boolean useHttps, ClientConfig config) {

        if (useHttps) {

            TrustManager[] certs = new TrustManager[] { new X509TrustManager() {

                public X509Certificate[] getAcceptedIssuers() {

                    return null;

                }

 

                public void checkServerTrusted(X509Certificate[] chain,

                        String authType) throws CertificateException {

                }

 

                public void checkClientTrusted(X509Certificate[] chain,

                        String authType) throws CertificateException {

                }

            } };

 

            SSLContext ctx = null;

            try {

                ctx = SSLContext.getInstance("TLS");

                ctx.init(null, certs, new SecureRandom());

            } catch (java.security.GeneralSecurityException ex) {

            }

            HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());

 

            try {

                config.getProperties().put(

                        HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,

                        new HTTPSProperties(new HostnameVerifier() {

                            public boolean verify(String hostname,

                                    SSLSession session) {

                                return true;

                            }

                        }, ctx));

            } catch (Exception e) {

            }

        }

}

Next, configure the client.

private static final int CONNECT_TIMEOUT = 30000; // 30 secs

private static final int READ_TIMEOUT = 30000; // 30 secs

 

private Client configureClient(String userName, String password,

            ClientConfig config) {

        Client client = Client.create(config);

        client.setConnectTimeout(CONNECT_TIMEOUT);

        client.setReadTimeout(READ_TIMEOUT);

        if (userName != null && userName.length() > 0 && password != null) {

            client.addFilter(new HTTPDigestAuthFilter(userName, password));

        }

        return client;

}

In the next step, create the service.

// Create the service

WebResource service = client.resource(getBaseURI(hostName, port, useHttps));

 

protected URI getBaseURI(String host, String port, boolean https)

        {

            String protocol = https ? "https://" : "http://";

            if (port != null) {

                return UriBuilder.fromUri(protocol + host + ":" + port + "/").build();

            } else {

                return UriBuilder.fromUri(protocol + host + "/").build();

            }

}

Next, obtain the proper media type in order to send the response correctly.

private String getMediaType(String format) {

        String mediaType = MediaType.TEXT_PLAIN;

        if (format != null) {

            if (format.equalsIgnoreCase("json")) {

                mediaType = MediaType.APPLICATION_JSON;

            } else if (format.equalsIgnoreCase("xml")) {

                mediaType = MediaType.APPLICATION_XML;

            }

        }

        return mediaType;

}

Finally, invoke the web service and obtain the response as a String.

String response = service.path("sws/v2/file/fsfileinfo")

                                    .queryParam("file", filePath)

                                    .queryParam("format", format)

                                    .accept(mediaType).get(String.class);

Below is an example of the response appears.

{
    "header": {
        "commandName": "fsfileinfo",
        "commandLine": "/usr/adic/TSM/bin/fsfileinfo -F json /stornext/snfx1/smp3data/command.config",
        "commandDescription": "Generate a report about files known to the Tertiary Manager",
        "localDateISO": "2015-08-21T23:48:16",
        "localDate": "2015-08-21",
        "localTime": "23:48:16",
        "localDayOfWeek": 5,
        "gmtDateISO": "2015-08-22T05:48:16Z",
        "gmtDate": "2015-08-22",
        "gmtTime": "05:48:16",
        "gmtDayOfWeek": 5
    },
    "fileInfos": [
        {
            "fileName": "/stornext/snfx1/smp3data/command.config",
            "storedPathFileName": "/stornext/snfx1/smp3data/command.config",
            "storedPathSameAsFileName": true,
            "lastModificationDateString": "31-jul-2015 01:44:07",
            "lastModificationDate": "2015-07-31",
            "lastModificationDayOfWeek": 5,
            "lastModificationTime": "01:44:07",
            "owner": "root",
            "location": "DISK AND ARCHIVE",
            "group": "root",
            "existingCopies": 2,
            "access": 644,
            "targetCopies": 2,
            "targetStubSize": 0,
            "targetStubScale": 1024,
            "existingStubSize": "n/a",
            "fileSize": 1435,
            "store": "MINTIME",
            "affinity": "n/a",
            "reloc": "MINTIME",
            "class": "smp3",
            "trunc": "MINTIME",
            "cleanDBInfo": "NO",
            "medias": [
                { "message": "unknown" },
                { "mediaId": "sdisk1", "copy": 2 }
            ],
            "checksums": [
                { "summary": "N" }
            ],
            "encryptions": [
                { "summary": "Y" }
            ],
            "compressions": [
                { "summary": "Y" }
            ],
            "objects": [
                { "summary": "Y" }
            ]
        }
    ],
    "statuses": [
        {
            "statusCode": "FS0000",
            "statusNumber": 0,
            "dayOfMonth": 21,
            "requestId": 153265,
            "commandName": "/usr/adic/TSM/bin/fsfileinfo",
            "commandStatus": "completed",
            "statusText": "Command Successful."
        }
    ],
    "footer": {
        "returnCode": 0,
        "localDateISOEnd": "2015-08-21T23:48:16",
        "localDateEnd": "2015-08-21",
        "localTimeEnd": "23:48:16",
        "localDayOfWeekEnd": 5,
        "gmtDateISOEnd": "2015-08-22T05:48:16Z",
        "gmtDateEnd": "2015-08-22",
        "gmtTimeEnd": "05:48:16",
        "gmtDayOfWeekEnd": 5,
        "elapsedTimeInSeconds": "0.0013"
    }
}

If the Authentication Type is configured to User, the username and password also requires to be passed as a query string.

String response = service.path("sws/v2/file/fsfileinfo")
                                    .queryParam("file", filePath)
                                    .queryParam("format", format)
                                    .queryParam("username", userName)
                                    .queryParam("password", password)
                                    .accept(mediaType).get(String.class);

Execute the same request using POST; the response is the same.

String inputX = "file=" + filePath;

String response = service.path("sws/v2/file/fsfileinfo")

                         .accept(mediaType).post(String.class, inputX);

Below is the full source code with other functions.

import java.net.URI;

import java.security.SecureRandom;

import java.security.cert.CertificateException;

import java.security.cert.X509Certificate;

 

import javax.net.ssl.HostnameVerifier;

import javax.net.ssl.HttpsURLConnection;

import javax.net.ssl.SSLContext;

import javax.net.ssl.SSLSession;

import javax.net.ssl.TrustManager;

import javax.net.ssl.X509TrustManager;

import javax.ws.rs.core.MediaType;

import javax.ws.rs.core.UriBuilder;

 

import com.sun.jersey.api.client.Client;

import com.sun.jersey.api.client.WebResource;

import com.sun.jersey.api.client.config.ClientConfig;

import com.sun.jersey.api.client.config.DefaultClientConfig;

import com.sun.jersey.api.client.filter.HTTPDigestAuthFilter;

import com.sun.jersey.client.urlconnection.HTTPSProperties;

 

public class SWSV2Samples {

    private static final int CONNECT_TIMEOUT = 30000;

    private static final int READ_TIMEOUT = 30000;

 

    public String getFsFileInfo(boolean useHttps, String userName,

            String password, String hostName, String port, String format,

            String filePath) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String mediaType = getMediaType(format);

        String response = service.path("sws/v2/file/fsfileinfo")

                .queryParam("file", filePath).queryParam("format", format)

  .queryParam("username", userName).queryParam("password", password)

                .accept(mediaType).get(String.class);

 

        return response;

    }

 

    public String postFsFileInfo (boolean useHttps, String userName,

            String password, String hostName, String port, String format,

            String filePath) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String inputX = "file=" + filePath;

        String mediaType = getMediaType(format);

        String response = service.path("sws/v2/file/fsfileinfo")

                .accept(mediaType).post(String.class, inputX);

 

        return response;

    }

 

    public String getFsClassInfo(boolean useHttps, String userName,

            String password, String hostName, String port, String format,

            String className) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String mediaType = getMediaType(format);

        String response = service.path("sws/v2/policy/fsclassinfo")

                .queryParam("policy", className).queryParam("format", format)

  .queryParam("username", userName).queryParam("password", password)

                .accept(mediaType).get(String.class);

 

        return response;

    }

 

    public String getFsDirClass(boolean useHttps, String userName,

            String password, String hostName, String port, String format,

            String filePath) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String mediaType = getMediaType(format);

        String response = service.path("sws/v2/policy/fsdirclass")

                .queryParam("directory", filePath).queryParam("format", format)

  .queryParam("username", userName).queryParam("password", password)

                .accept(mediaType).get(String.class);

 

        return response;

    }

 

    public String getFsStore(boolean useHttps, String userName,

            String password, String hostName, String port, String format,

            String filePath, int copies) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String mediaType = getMediaType(format);

        String response = service.path("sws/v2/file/fsstore")

                .queryParam("file", filePath)

                .queryParam("copies", Integer.toString(copies))

                .queryParam("format", format).accept(mediaType)

   .queryParam("username", userName).queryParam("password", password)

                .get(String.class);

 

        return response;

    }

 

    public String getFsRmDiskCopy(boolean useHttps, String userName,

            String password, String hostName, String port, String format,

            String filePath) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String mediaType = getMediaType(format);

        String response = service.path("sws/v2/file/fsrmdiskcopy")

                .queryParam("file", filePath).queryParam("format", format)

   .queryParam("username", userName).queryParam("password", password)

                .accept(mediaType).get(String.class);

 

        return response;

    }

 

    public String getFsRetrieve(boolean useHttps, String userName,

            String password, String hostName, String port, String format,

            String filePath) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String mediaType = getMediaType(format);

        String response = service.path("sws/v2/file/fsretrieve")

                .queryParam("file", filePath).queryParam("format", format)

   .queryParam("username", userName).queryParam("password", password)

                .accept(mediaType).get(String.class);

 

        return response;

    }

 

    public String getCreateSnQuota(boolean useHttps, String userName,

            String password, String hostName, String port, String format,

            String fspath, String dirPath) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String mediaType = getMediaType(format);

        String response = service.path("sws/v2/quota/snquota")

                .queryParam("path", fspath).queryParam("directory", dirPath)

                .queryParam("action", "create").queryParam("format", format)

  .queryParam("username", userName).queryParam("password", password)

                .accept(mediaType).get(String.class);

 

        return response;

    }

 

    public String getSetSnQuota(boolean useHttps, String userName,

            String password, String hostName, String port, String format,

            String fspath, String dirPath, String hardLimit, String softLimit,

            String gracePeriod) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String mediaType = getMediaType(format);

        String response = service.path("sws/v2/quota/snquota")

                .queryParam("path", fspath).queryParam("directory", dirPath)

                .queryParam("action", "set").queryParam("hardlimit", hardLimit)

                .queryParam("softlimit", softLimit)

                .queryParam("graceperiod", gracePeriod)

   .queryParam("username", userName).queryParam("password", password)

                .queryParam("format", format).accept(mediaType)

                .get(String.class);

 

        return response;

    }

 

    public String getListSnQuota(boolean useHttps, String userName,

            String password, String hostName, String port, String format,

            String fsname) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String mediaType = getMediaType(format);

        String response = service.path("sws/v2/quota/snquota")

                .queryParam("fsname", fsname).queryParam("action", "listall")

  .queryParam("username", userName).queryParam("password", password)

                .queryParam("format", format).accept(mediaType)

                .get(String.class);

 

        return response;

    }

 

    private String getMediaType(String format) {

        String mediaType = MediaType.TEXT_PLAIN;

        if (format != null) {

            if (format.equalsIgnoreCase("json")) {

                mediaType = MediaType.APPLICATION_JSON;

            } else if (format.equalsIgnoreCase("xml")) {

                mediaType = MediaType.APPLICATION_XML;

            }

        }

        return mediaType;

    }

 

    private Client configureClient(String userName, String password,

            ClientConfig config) {

        Client client = Client.create(config);

        client.setConnectTimeout(CONNECT_TIMEOUT);

        client.setReadTimeout(READ_TIMEOUT);

        if (userName != null && userName.length() > 0 && password != null) {

            client.addFilter(new HTTPDigestAuthFilter(userName, password));

        }

        return client;

    }

 

    private void setupSSL(boolean useHttps, ClientConfig config) {

        if (useHttps) {

            TrustManager[] certs = new TrustManager[] { new X509TrustManager() {

                public X509Certificate[] getAcceptedIssuers() {

                    return null;

                }

 

                public void checkServerTrusted(X509Certificate[] chain,

                        String authType) throws CertificateException {

                }

 

                public void checkClientTrusted(X509Certificate[] chain,

                        String authType) throws CertificateException {

                }

            } };

 

            SSLContext ctx = null;

            try {

                ctx = SSLContext.getInstance("TLS");

                ctx.init(null, certs, new SecureRandom());

            } catch (java.security.GeneralSecurityException ex) {

            }

            HttpsURLConnection.setDefaultSSLSocketFactory(ctx

                    .getSocketFactory());

 

            try {

                config.getProperties().put(

                        HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,

                        new HTTPSProperties(new HostnameVerifier() {

                            public boolean verify(String hostname,

                                    SSLSession session) {

                                return true;

                            }

                        }, ctx));

            } catch (Exception e) {

            }

        }

    }

 

    private ClientConfig getClientConfig() {

        ClientConfig config = new DefaultClientConfig();

        return config;

    }

 

    protected URI getBaseURI(String host, String port, boolean https) {

        String protocol = https ? "https://" : "http://";

        if (port != null) {

            return UriBuilder.fromUri(protocol + host + ":" + port + "/")

                    .build();

        } else {

            return UriBuilder.fromUri(protocol + host + "/").build();

        }

    }

 

}

In the next few examples, the assumption is that the Protocol is https and Authentication Type is User. The username is wsuser and the password is wspass. Also, JSON is the format of response.

Consider a managed file system smpltomedia mounted at /stornext/snfx1/smpltomedia and a file named foobar0in the file system. We attempt to store the file, remove the disk copy and retrieve it using web services available in SWS V2. Refer the source cod above.

First, check the file information. Use the fsfileinfo web service.

String response = caller.getFsFileInfo(true, "wsuser", "wspass",
                                      "192.168.36.128", "444", "json", 
                                      "/stornext/snfx1/smpltomedia/foobar0");
System.out.println(response);

The output is shown below. Notice the location of the file is reported as DISK since the file has not yet been stored.

{
    "header": {
        "commandName": "fsfileinfo",
        "commandLine": "/usr/adic/TSM/bin/fsfileinfo -F json /stornext/snfx1/smpltomedia/foobar0",
        "commandDescription": "Generate a report about files known to the Tertiary Manager",
        "localDateISO": "2015-10-26T19:42:34",
        "localDate": "2015-10-26",
        "localTime": "19:42:34",
        "localDayOfWeek": 1,
        "gmtDateISO": "2015-10-27T01:42:34Z",
        "gmtDate": "2015-10-27",
        "gmtTime": "01:42:34",
        "gmtDayOfWeek": 1
    },
    "fileInfos": [
        {
            "fileName": "/stornext/snfx1/smpltomedia/foobar0",
            "storedPathFileName": "N/A",
            "storedPathSameAsFileName": false,
            "lastModificationDateString": "26-oct-2015 19:42:08",
            "lastModificationDate": "2015-10-26",
            "lastModificationDayOfWeek": 1,
            "lastModificationTime": "19:42:08",
            "owner": "root",
            "location": "DISK",
            "group": "root",
            "existingCopies": 0,
            "access": 664,
            "targetCopies": 1,
            "targetStubSize": 0,
            "targetStubScale": 1024,
            "existingStubSize": "n/a",
            "fileSize": 10485760,
            "store": "MINTIME",
            "affinity": "n/a",
            "reloc": "MINTIME",
            "class": "smpltomedia",
            "trunc": "MINTIME",
            "cleanDBInfo": "NO",
            "altStoreLocation": "Disabled",
            "medias": [
                { "message": "None" }
            ],
            "checksums": [
                { "summary": "N" }
            ],
            "encryptions": [
                { "summary": "N" }
            ],
            "compressions": [
                { "summary": "N" }
            ],
            "objects": [
                { "summary": "N" }
            ]
        }
    ],
    "statuses": [
        {
            "statusCode": "FS0000",
            "statusNumber": 0,
            "dayOfMonth": 26,
            "requestId": 176855,
            "commandName": "/usr/adic/TSM/bin/fsfileinfo",
            "commandStatus": "completed",
            "statusText": "Command Successful."
        }
    ],
    "footer": {
        "returnCode": 0,
        "localDateISOEnd": "2015-10-26T19:42:34",
        "localDateEnd": "2015-10-26",
        "localTimeEnd": "19:42:34",
        "localDayOfWeekEnd": 1,
        "gmtDateISOEnd": "2015-10-27T01:42:34Z",
        "gmtDateEnd": "2015-10-27",
        "gmtTimeEnd": "01:42:34",
        "gmtDayOfWeekEnd": 1,
        "elapsedTimeInSeconds": "0.0006"
    }
}

Now, try to find out what policy this file path is associated with. Use the fsdirclass web service.

String response = caller.getFsDirClass(true, "wsuser", "wspass",
                    "192.168.36.128", "444", "text", "/stornext/snfx1/smpltomedia");
System.out.println(response);

The output is shown below. Notice the path is associated with the smpltomedia policy.

{
    "header": {
        "commandName": "fsdirclass",
        "commandLine": "/usr/adic/TSM/bin/fsdirclass /stornext/snfx1/smpltomedia -F json",
        "commandDescription": "Report the policy class associated with a directory.",
        "localDateISO": "2015-10-26T19:44:07",
        "localDate": "2015-10-26",
        "localTime": "19:44:07",
        "localDayOfWeek": 1,
        "gmtDateISO": "2015-10-27T01:44:07Z",
        "gmtDate": "2015-10-27",
        "gmtTime": "01:44:07",
        "gmtDayOfWeek": 1
    },
    "directories": [
        {
            "directoryName": "/stornext/snfx1/smpltomedia",
            "classId": "smpltomedia"
        }
    ],
    "statuses": [
        {
            "statusCode": "FS0000",
            "statusNumber": 0,
            "dayOfMonth": 26,
            "requestId": 176858,
            "commandName": "/usr/adic/TSM/bin/fsdirclass",
            "commandStatus": "completed",
            "statusText": "Command Successful."
        }
    ],
    "footer": {
        "returnCode": 0,
        "localDateISOEnd": "2015-10-26T19:44:07",
        "localDateEnd": "2015-10-26",
        "localTimeEnd": "19:44:07",
        "localDayOfWeekEnd": 1,
        "gmtDateISOEnd": "2015-10-27T01:44:07Z",
        "gmtDateEnd": "2015-10-27",
        "gmtTimeEnd": "01:44:07",
        "gmtDayOfWeekEnd": 1,
        "elapsedTimeInSeconds": "0.0001"
    }
}

Now, review the smpltomedia policy. Use the fsclassinfo web service.

String response = caller.getFsClassInfo(true, "wsuser", "wspass",
                    "192.168.36.128", "444", "json", "smpltomedia");
System.out.println(response);

The output is shown below.

{
    "header": {
        "commandName": "fsclassinfo",
        "commandLine": "/usr/adic/TSM/bin/fsclassinfo smpltomedia -F json",
        "commandDescription": "Report policy class processing parameters, associated directory paths, and affinity lists.",
        "localDateISO": "2015-10-26T19:45:13",
        "localDate": "2015-10-26",
        "localTime": "19:45:13",
        "localDayOfWeek": 1,
        "gmtDateISO": "2015-10-27T01:45:13Z",
        "gmtDate": "2015-10-27",
        "gmtTime": "01:45:13",
        "gmtDayOfWeek": 1
    },
    "classes": [
        {
            "classId": "smpltomedia",
            "softLimit": 20000,
            "hardLimit": 25000,
            "drivePool": "fs_F0drivepool",
            "securityCode": "NONE",
            "acctNumber": 12345,
            "defCopies": 1,
            "maxCopies": 4,
            "maxInactiveVersions": 10,
            "mediaType": "LTO",
            "fileCleanup": "MINTIME",
            "mediaCleanup": "SYSTEM",
            "storeMinTime": "5m",
            "storeMaxSetAge": "n/a",
            "storeMinSetSize": "n/a",
            "storeAutomatically": "yes",
            "relocMinTime": "7d",
            "truncMinTime": "3d",
            "generateChecksum": "DISABLED",
            "validateChecksum": "DISABLED",
            "cleanOnRemove": "DISABLED",
            "targetStubSize": 0,
            "encryption": "None",
            "altStoreLocation": "DISABLED",
            "masterKeyName": "",
            "compression": "None"
        }
    ],
    "statuses": [
        {
            "statusCode": "FS0000",
            "statusNumber": 0,
            "dayOfMonth": 26,
            "requestId": 176861,
            "commandName": "/usr/adic/TSM/bin/fsclassinfo",
            "commandStatus": "completed",
            "statusText": "Command Successful."
        }
    ],
    "footer": {
        "returnCode": 0,
        "localDateISOEnd": "2015-10-26T19:45:13",
        "localDateEnd": "2015-10-26",
        "localTimeEnd": "19:45:13",
        "localDayOfWeekEnd": 1,
        "gmtDateISOEnd": "2015-10-27T01:45:13Z",
        "gmtDateEnd": "2015-10-27",
        "gmtTimeEnd": "01:45:13",
        "gmtDayOfWeekEnd": 1,
        "elapsedTimeInSeconds": "0.0002"
    }
}

Store the foobar0 file using the fsstore web service; only store one copy of the file.

String response = caller.getFsStore(true, "wsuser", "wspass", 
                   "192.168.36.128", "444", "json",
                   /stornext/snfx1/smpltomedia/foobar0", 1);
System.out.println(response);

The output is shown below.

{
    "header": {
        "commandName": "fsstore",
        "commandLine": "/usr/adic/TSM/bin/fsstore -c 1 -F json /stornext/snfx1/smpltomedia/foobar0",
        "commandDescription": "Request the storage of a file that currently resides on disk to media",
        "localDateISO": "2015-10-26T19:46:30",
        "localDate": "2015-10-26",
        "localTime": "19:46:30",
        "localDayOfWeek": 1,
        "gmtDateISO": "2015-10-27T01:46:30Z",
        "gmtDate": "2015-10-27",
        "gmtTime": "01:46:30",
        "gmtDayOfWeek": 1
    },
    "statuses": [
        {
            "statusCode": "FS0589",
            "statusNumber": 589,
            "dayOfMonth": 26,
            "requestId": 176864,
            "commandName": "/usr/adic/TSM/bin/fsstore",
            "commandStatus": "interim",
            "statusText": "Tertiary Manager software request received."
        },
        {
            "statusCode": "FS0799",
            "statusNumber": 799,
            "dayOfMonth": 26,
            "requestId": 176864,
            "commandName": "/usr/adic/TSM/bin/fsstore",
            "commandStatus": "interim",
            "statusText": "1 file store request(s) have been sent to Tertiary Manager."
        },
        {
            "statusCode": "FS0346",
            "statusNumber": 346,
            "dayOfMonth": 26,
            "requestId": 176864,
            "commandName": "fsstore",
            "commandStatus": "interim",
            "statusText": "File /stornext/snfx1/smpltomedia/foobar0 copy 1 has been stored."
        },
        {
            "statusCode": "FS0390",
            "statusNumber": 390,
            "dayOfMonth": 26,
            "requestId": 176864,
            "commandName": "fsstore",
            "commandStatus": "completed",
            "statusText": "1 out of 1 statuses were successful."
        },
        {
            "statusCode": "FS0000",
            "statusNumber": 0,
            "dayOfMonth": 26,
            "requestId": 176864,
            "commandName": "fsstore",
            "commandStatus": "completed",
            "statusText": "Command Successful."
        }
    ],
    "footer": {
        "returnCode": 0,
        "localDateISOEnd": "2015-10-26T19:46:33",
        "localDateEnd": "2015-10-26",
        "localTimeEnd": "19:46:33",
        "localDayOfWeekEnd": 1,
        "gmtDateISOEnd": "2015-10-27T01:46:33Z",
        "gmtDateEnd": "2015-10-27",
        "gmtTimeEnd": "01:46:33",
        "gmtDayOfWeekEnd": 1,
        "elapsedTimeInSeconds": "3.0097"
    }
}

When the file is stored, execute the fsfileinfo web service again to ensure the file is stored.

String response = caller.getFsFileInfo(true, "wsuser", "wspass", 
                   "192.168.36.128", "444", "json",
                   "/stornext/snfx1/smpltomedia/foobar0");
System.out.println(response);

Notice the location reads DISK AND ARCHIVE, which signifies the file is stored.

{
    "header": {
        "commandName": "fsfileinfo",
        "commandLine": "/usr/adic/TSM/bin/fsfileinfo -F json /stornext/snfx1/smpltomedia/foobar0",
        "commandDescription": "Generate a report about files known to the Tertiary Manager",
        "localDateISO": "2015-10-26T19:47:45",
        "localDate": "2015-10-26",
        "localTime": "19:47:45",
        "localDayOfWeek": 1,
        "gmtDateISO": "2015-10-27T01:47:45Z",
        "gmtDate": "2015-10-27",
        "gmtTime": "01:47:45",
        "gmtDayOfWeek": 1
    },
    "fileInfos": [
        {
            "fileName": "/stornext/snfx1/smpltomedia/foobar0",
            "storedPathFileName": "/stornext/snfx1/smpltomedia/foobar0",
            "storedPathSameAsFileName": true,
            "lastModificationDateString": "26-oct-2015 19:42:08",
            "lastModificationDate": "2015-10-26",
            "lastModificationDayOfWeek": 1,
            "lastModificationTime": "19:42:08",
            "owner": "root",
            "location": "DISK AND ARCHIVE",
            "group": "root",
            "existingCopies": 1,
            "access": 664,
            "targetCopies": 1,
            "targetStubSize": 0,
            "targetStubScale": 1024,
            "existingStubSize": "n/a",
            "fileSize": 10485760,
            "store": "MINTIME",
            "affinity": "n/a",
            "reloc": "MINTIME",
            "class": "smpltomedia",
            "trunc": "MINTIME",
            "cleanDBInfo": "NO",
            "altStoreLocation": "Disabled",
            "medias": [
                { "mediaId": "000005", "copy": 1 }
            ],
            "checksums": [
                { "summary": "N" }
            ],
            "encryptions": [
                { "summary": "N" }
            ],
            "compressions": [
                { "summary": "N" }
            ],
            "objects": [
                { "summary": "N" }
            ]
        }
    ],
    "statuses": [
        {
            "statusCode": "FS0000",
            "statusNumber": 0,
            "dayOfMonth": 26,
            "requestId": 176872,
            "commandName": "/usr/adic/TSM/bin/fsfileinfo",
            "commandStatus": "completed",
            "statusText": "Command Successful."
        }
    ],
    "footer": {
        "returnCode": 0,
        "localDateISOEnd": "2015-10-26T19:47:45",
        "localDateEnd": "2015-10-26",
        "localTimeEnd": "19:47:45",
        "localDayOfWeekEnd": 1,
        "gmtDateISOEnd": "2015-10-27T01:47:45Z",
        "gmtDateEnd": "2015-10-27",
        "gmtTimeEnd": "01:47:45",
        "gmtDayOfWeekEnd": 1,
        "elapsedTimeInSeconds": "0.0007"
    }
}

Remove the disk copy of the file using the fsrmdiskcopy web service.

String response = caller.getFsRmDiskCopy(true, "wsuser", "wspass", 
                   "192.168.36.128", "444", "json",
                   "/stornext/snfx1/smpltomedia/foobar0");
System.out.println(response);

The output is shown below.

{
    "header": {
        "commandName": "fsrmdiskcopy",
        "commandLine": "/usr/adic/TSM/bin/fsrmdiskcopy -F json /stornext/snfx1/smpltomedia/foobar0",
        "commandDescription": "Remove file data blocks from disk after the file was stored to a medium",
        "localDateISO": "2015-10-26T19:49:58",
        "localDate": "2015-10-26",
        "localTime": "19:49:58",
        "localDayOfWeek": 1,
        "gmtDateISO": "2015-10-27T01:49:58Z",
        "gmtDate": "2015-10-27",
        "gmtTime": "01:49:58",
        "gmtDayOfWeek": 1
    },
    "statuses": [
        {
            "statusCode": "FS0266",
            "statusNumber": 266,
            "dayOfMonth": 26,
            "requestId": 176881,
            "commandName": "/usr/adic/TSM/bin/fsrmdiskcopy",
            "commandStatus": "interim",
            "statusText": "Data disk blocks for file /stornext/snfx1/smpltomedia/foobar0 were successfully removed."
        },
        {
            "statusCode": "FS0390",
            "statusNumber": 390,
            "dayOfMonth": 26,
            "requestId": 176881,
            "commandName": "/usr/adic/TSM/bin/fsrmdiskcopy",
            "commandStatus": "completed",
            "statusText": "1 out of 1 disk copy removes were successful."
        }
    ],
    "footer": {
        "returnCode": 0,
        "localDateISOEnd": "2015-10-26T19:49:58",
        "localDateEnd": "2015-10-26",
        "localTimeEnd": "19:49:58",
        "localDayOfWeekEnd": 1,
        "gmtDateISOEnd": "2015-10-27T01:49:58Z",
        "gmtDateEnd": "2015-10-27",
        "gmtTimeEnd": "01:49:58",
        "gmtDayOfWeekEnd": 1,
        "elapsedTimeInSeconds": "0.0005"
    }
}

Verify the file is removed using the fsfileinfo command.

String response = caller.getFsFileInfo(true, "wsuser", "wspass",
                   "192.168.36.128", "444", "json",
                   "/stornext/snfx1/smpltomedia/foobar0");
System.out.println(response);

Notice the location of the file is ARCHIVE which signifies the disk copy is removed.

{
    "header": {
        "commandName": "fsfileinfo",
        "commandLine": "/usr/adic/TSM/bin/fsfileinfo -F json /stornext/snfx1/smpltomedia/foobar0",
        "commandDescription": "Generate a report about files known to the Tertiary Manager",
        "localDateISO": "2015-10-26T19:53:15",
        "localDate": "2015-10-26",
        "localTime": "19:53:15",
        "localDayOfWeek": 1,
        "gmtDateISO": "2015-10-27T01:53:15Z",
        "gmtDate": "2015-10-27",
        "gmtTime": "01:53:15",
        "gmtDayOfWeek": 1
    },
    "fileInfos": [
        {
            "fileName": "/stornext/snfx1/smpltomedia/foobar0",
            "storedPathFileName": "/stornext/snfx1/smpltomedia/foobar0",
            "storedPathSameAsFileName": true,
            "lastModificationDateString": "26-oct-2015 19:42:08",
            "lastModificationDate": "2015-10-26",
            "lastModificationDayOfWeek": 1,
            "lastModificationTime": "19:42:08",
            "owner": "root",
            "location": "ARCHIVE",
            "group": "root",
            "existingCopies": 1,
            "access": 664,
            "targetCopies": 1,
            "targetStubSize": 0,
            "targetStubScale": 1024,
            "existingStubSize": 0,
            "existingStubScale": 1024,
            "fileSize": 10485760,
            "store": "MINTIME",
            "affinity": "n/a",
            "reloc": "MINTIME",
            "class": "smpltomedia",
            "trunc": "MINTIME",
            "cleanDBInfo": "NO",
            "altStoreLocation": "Disabled",
            "medias": [
                { "mediaId": "000005", "copy": 1 }
            ],
            "checksums": [
                { "summary": "N" }
            ],
            "encryptions": [
                { "summary": "N" }
            ],
            "compressions": [
                { "summary": "N" }
            ],
            "objects": [
                { "summary": "N" }
            ]
        }
    ],
    "statuses": [
        {
            "statusCode": "FS0000",
            "statusNumber": 0,
            "dayOfMonth": 26,
            "requestId": 176888,
            "commandName": "/usr/adic/TSM/bin/fsfileinfo",
            "commandStatus": "completed",
            "statusText": "Command Successful."
        }
    ],
    "footer": {
        "returnCode": 0,
        "localDateISOEnd": "2015-10-26T19:53:15",
        "localDateEnd": "2015-10-26",
        "localTimeEnd": "19:53:15",
        "localDayOfWeekEnd": 1,
        "gmtDateISOEnd": "2015-10-27T01:53:15Z",
        "gmtDateEnd": "2015-10-27",
        "gmtTimeEnd": "01:53:15",
        "gmtDayOfWeekEnd": 1,
        "elapsedTimeInSeconds": "0.0004"
    }
}

Retrieve the file using the fsretrieve web service.

String response = caller.getFsRetrieve(true, "wsuser", "wspass",
                   "192.168.36.128", "444", "json",
                   "/stornext/snfx1/smpltomedia/foobar0");
System.out.println(response);

Notice the retrieve operation is successful.

{
    "header": {
        "commandName": "fsretrieve",
        "commandLine": "/usr/adic/TSM/bin/fsretrieve -F json /stornext/snfx1/smpltomedia/foobar0",
        "commandDescription": "Retrieve files from media and place on disk",
        "localDateISO": "2015-10-26T19:54:45",
        "localDate": "2015-10-26",
        "localTime": "19:54:45",
        "localDayOfWeek": 1,
        "gmtDateISO": "2015-10-27T01:54:45Z",
        "gmtDate": "2015-10-27",
        "gmtTime": "01:54:45",
        "gmtDayOfWeek": 1
    },
    "statuses": [
        {
            "statusCode": "FS0589",
            "statusNumber": 589,
            "dayOfMonth": 26,
            "requestId": 176893,
            "commandName": "/usr/adic/TSM/bin/fsretrieve",
            "commandStatus": "interim",
            "statusText": "Tertiary Manager software request received."
        },
        {
            "statusCode": "FS0347",
            "statusNumber": 347,
            "dayOfMonth": 26,
            "requestId": 176893,
            "commandName": "fsretrieve",
            "commandStatus": "interim",
            "statusText": "File /stornext/snfx1/smpltomedia/foobar0 has been retrieved."
        },
        {
            "statusCode": "FS0390",
            "statusNumber": 390,
            "dayOfMonth": 26,
            "requestId": 176893,
            "commandName": "fsretrieve",
            "commandStatus": "completed",
            "statusText": "1 out of 1 retrieves were successful."
        }
    ],
    "footer": {
        "returnCode": 0,
        "localDateISOEnd": "2015-10-26T19:54:46",
        "localDateEnd": "2015-10-26",
        "localTimeEnd": "19:54:46",
        "localDayOfWeekEnd": 1,
        "gmtDateISOEnd": "2015-10-27T01:54:46Z",
        "gmtDateEnd": "2015-10-27",
        "gmtTimeEnd": "01:54:46",
        "gmtDayOfWeekEnd": 1,
        "elapsedTimeInSeconds": "0.0679"
    }
}

Execute fsfileinfo one last time to ensure the file is retrieved.

String response = caller.getFsFileInfo(true, "wsuser", "wspass",
                   "192.168.36.128", "444", "json",
                   "/stornext/snfx1/smpltomedia/foobar0");
System.out.println(response);

Notice the location reads DISK AND ARCHIVE which signifies the file is retrieved.

{
    "header": {
        "commandName": "fsfileinfo",
        "commandLine": "/usr/adic/TSM/bin/fsfileinfo -F json /stornext/snfx1/smpltomedia/foobar0",
        "commandDescription": "Generate a report about files known to the Tertiary Manager",
        "localDateISO": "2015-10-26T19:57:04",
        "localDate": "2015-10-26",
        "localTime": "19:57:04",
        "localDayOfWeek": 1,
        "gmtDateISO": "2015-10-27T01:57:04Z",
        "gmtDate": "2015-10-27",
        "gmtTime": "01:57:04",
        "gmtDayOfWeek": 1
    },
    "fileInfos": [
        {
            "fileName": "/stornext/snfx1/smpltomedia/foobar0",
            "storedPathFileName": "/stornext/snfx1/smpltomedia/foobar0",
            "storedPathSameAsFileName": true,
            "lastModificationDateString": "26-oct-2015 19:42:08",
            "lastModificationDate": "2015-10-26",
            "lastModificationDayOfWeek": 1,
            "lastModificationTime": "19:42:08",
            "owner": "root",
            "location": "DISK AND ARCHIVE",
            "group": "root",
            "existingCopies": 1,
            "access": 664,
            "targetCopies": 1,
            "targetStubSize": 0,
            "targetStubScale": 1024,
            "existingStubSize": "n/a",
            "fileSize": 10485760,
            "store": "MINTIME",
            "affinity": "n/a",
            "reloc": "MINTIME",
            "class": "smpltomedia",
            "trunc": "MINTIME",
            "cleanDBInfo": "NO",
            "altStoreLocation": "Disabled",
            "medias": [
                { "mediaId": "000005", "copy": 1 }
            ],
            "checksums": [
                { "summary": "N" }
            ],
            "encryptions": [
                { "summary": "N" }
            ],
            "compressions": [
                { "summary": "N" }
            ],
            "objects": [
                { "summary": "N" }
            ]
        }
    ],
    "statuses": [
        {
            "statusCode": "FS0000",
            "statusNumber": 0,
            "dayOfMonth": 26,
            "requestId": 176898,
            "commandName": "/usr/adic/TSM/bin/fsfileinfo",
            "commandStatus": "completed",
            "statusText": "Command Successful."
        }
    ],
    "footer": {
        "returnCode": 0,
        "localDateISOEnd": "2015-10-26T19:57:04",
        "localDateEnd": "2015-10-26",
        "localTimeEnd": "19:57:04",
        "localDayOfWeekEnd": 1,
        "gmtDateISOEnd": "2015-10-27T01:57:04Z",
        "gmtDateEnd": "2015-10-27",
        "gmtTimeEnd": "01:57:04",
        "gmtDayOfWeekEnd": 1,
        "elapsedTimeInSeconds": "0.0007"
    }
}

There are several other operations to perform using the SWS V2 web services. For example, you can create a quota on a directory in a managed file system and set the quota limits.

Note: Ensure quotas are enabled before you run the web services. For information on how to enable quotas, see the StorNext 5 User's Guide online at http://www.quantum.com/sn5docs.

Create a quota for a directory /smpltomedia/media in the snfx1 filesystem. Refer to sample code above.

String response = caller.getCreateSnQuota(true, "wsuser", "wspass",
                   "192.168.36.128", "444", "json", "/stornext/snfx1",
                   "/smpltomedia/media");
System.out.println(response);

The output is shown below. An exit code of 0 signifies the quota is created.

{
    "returnCode": 0
}

Set the high limit to 10 GB, soft limit to 1 GB and grace period to 1 week.

String response = caller.getSetSnQuota(true, "wsuser", "wspass",
                   "192.168.36.128", "444", "text", "/stornext/snfx1",
                   "/smpltomedia/media", "10g", "1g", "1w");
System.out.println(response);

The output displays the quota limits are set.

{
    "directoryQuotas": [
        {
            "hardLimit": "10G",
            "softLimit": "1.0G",
            "gracePeriod": "1w",
            "curSize": 0,
            "status": "Under",
            "type": "dir",
            "name": "/smpltomedia/media"
        }
    ],
    "returnCode": 0
}

To verify, use the snquota web service to retrieve a list of quotas for snfx1.

String response = caller.getListSnQuota(true, "wsuser", "wspass",
                   "192.168.36.128", "444", "text", "snfx1");
System.out.println(response);

The output shown below displays the quota values are set.

{
    "userQuotas": [
        {
            "hardLimit": 0,
            "softLimit": 0,
            "gracePeriod": "0m",
            "curSize": "4.6G",
            "status": "NoLimit",
            "type": "user",
            "name": "root"
        }
    ],
    "groupQuotas": [
        {
            "hardLimit": 0,
            "softLimit": 0,
            "gracePeriod": "0m",
            "curSize": "4.6G",
            "status": "NoLimit",
            "type": "group",
            "name": "root"
        }
    ],
    "directoryQuotas": [
        {
            "hardLimit": "10G",
            "softLimit": "1.0G",
            "gracePeriod": "1w",
            "curSize": 0,
            "status": "Under",
            "type": "dir",
            "name": "/smpltomedia/media"
        },
        {
            "hardLimit": 0,
            "softLimit": 0,
            "gracePeriod": "0m",
            "curSize": 0,
            "status": "NoLimit",
            "type": "dirfiles",
            "name": "/smpltomedia/media"
        }
    ],
    "returnCode": 0
}

You can also run SWS V2 web services asynchronously. This is especially helpful for long running processes like storing several files or retrieving them. First, write the code to send a fsretrieve request with async mode. For this example, we will assume that we are running a fsretrieve operation asynchronously on 10 files in a particular directory.

public String getFsRetrieveAsync(boolean useHttps, String userName,

            String password, String hostName, String port, String format) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String mediaType = getMediaType(format);

        MultivaluedMap<String, String> params = new MultivaluedMapImpl();

        for (int i=1; i<=10; i++) {

            params.add("file", "/stornext/snfx1/smp1data/foobar" + i);

        }

       

        String response = service.path("sws/v2/file/fsretrieve")

                .queryParams(params)

                .queryParam("mode", "async")

                .queryParam("format", format).accept(mediaType)

                .get(String.class);

 

        return response;

}

Notice the use of a MultivaluedMap to populate a list of 10 files. If you have just one file, ignore this. Next, the code must find the job status (for example, if the job is running or completed).

public String getJobStatus(boolean useHttps, String userName,

            String password, String hostName, String port, String jobID) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        String mediaType = getMediaType("text");

        String response = service.path("sws/v2/job/info")

                .queryParam("job", jobID).accept(mediaType)

                .get(String.class);

 

        return response;

}

A detailed job status with interim transfer details is available for store (fsstore) and retrieve (fsretrieve) operations.

// Only available for fsstore and fsretrieve

public String getMoverJobStatus(boolean useHttps, String userName,

            String password, String hostName, String port, String... jobIDList) {

        ClientConfig config = getClientConfig();

 

        setupSSL(useHttps, config);

        Client client = configureClient(userName, password, config);

        WebResource service = client.resource(getBaseURI(hostName, port,

                useHttps));

        MultivaluedMap<String, String> params = new MultivaluedMapImpl();

        for (String job: jobIDList) {

            params.add("job", job);

        }

        String mediaType = getMediaType("json");

        String response = service.path("sws/v2/job/mover/info")

                .queryParams(params).accept(mediaType)

                .get(String.class);

 

        return response;

}

Below is an example of a job status query. The job parameter displays the job ID of the job. The state parameter displays the current state of the job. The valid values for state are READY, QUEUED, RUNNING, COMPLETED and ERROR.

{

    "jobList": [

        {

            "jobInfo": {

                "job": "27",

                "state": "RUNNING"

            }

        }

    ]

}

Below is an example of a detailed mover job status query.

Parameter Description

"moverRequestList"

This section displays the jobs that are executed by the storage manager. This section displays a requestId assigned by the storage manager.

  • The requestType can either be Store or Retrieve.
  • The state parameter displays the current state of the job. The valid values for state are READY, QUEUE, PROCESS, FORMAT, COPY and COMPLETE.
  • The positioninqueue parameter displays the position of the job in the storage manager queue.

"moverProgressList"

This section displays the job that is currently running in the storage manager.

  • The host parameter displays the hostname of the system in which this job is being executed. The storage manager assigns the requestId when the job is registered under storage manager for execution.
  • The deviceAlias is the alias for the drive on which this job is being executed. 
  • The runTime parameter displays the time that has elapsed since the job started.
  • The totalFiles parameter displays the number of files that will be copied for this job.
  • The filesCopied parameter displays the files that have already been completed.
  • The filesFailed parameter displays the number of files that could not be copied.

"completedJobList"

This section displays the jobs that have completed execution and begins with header information in the header node.

  • The jobInfo node displays details about a particular job.
  • The statuses node contains individual status of files that are being copied in this particular job.
  • The footer section contains footer information.

"pendingJobList"

This section displays the jobs that are waiting to be executed by the storage manager.

  • The job parameter displays the job Id.
  • The positioninagentqueue is the position of the job in the agent queue.
  • The exitcode parameter displays the current exit code.
  • The state of waiting jobs is shown. In general, state for a waiting job is QUEUED.

[

    {

        "moverRequestList": [

            {

                "requestId": "177193",

                "requestType": "Retrieve",

                "state": "COPY",

                "positioninqueue": 1

            },

            {

                "requestId": "177194",

                "requestType": "Retrieve",

                "state": "READY",

                "positioninqueue": 2

            },

            {

                "requestId": "177205",

                "requestType": "Retrieve",

                "state": "READY",

                "positioninqueue": 3

            },

            {

                "requestId": "177213",

                "requestType": "Retrieve",

                "state": "READY",

                "positioninqueue": 4

            }

        ],

        "moverProgressList": [

            {

                "host": "REDHAT5-DEMO",

                "requestId": "177193",

                "deviceAlias": "archives_dr1",

                "runTime": "00:00:03",

                "totalFiles": "3",

                "filesCopied": "1",

                "filesFailed": "0"

            }

        ]

    },

    {

        "completedJobList": [

            {

                "header": {

                    "commandName": "fsretrieve",

                    "commandLine": "/usr/adic/TSM/bin/fsretrieve -F json /stornext/snfx1/smp2data/soobar1 /stornext/snfx1/smp2data/soobar2 /stornext/snfx1/smp2data/soobar3 /stornext/snfx1/smp2data/soobar4 /stornext/snfx1/smp2data/soobar5",

                    "commandDescription": "Retrieve files from media and place on disk",

                    "localDateISO": "2015-10-27T17:05:09",

                    "localDate": "2015-10-27",

                    "localTime": "17:05:09",

                    "localDayOfWeek": 2,

                    "gmtDateISO": "2015-10-27T23:05:09Z",

                    "gmtDate": "2015-10-27",

                    "gmtTime": "23:05:09",

                    "gmtDayOfWeek": 2

                },

                "jobInfo": {

                    "job": "24",

                    "exitcode": 0,

                    "datecompleted": "2015-10-27 17:05:20",

                    "state": "COMPLETED"

                },

                "statuses": [

                    {

                        "statusCode": "FS0005",

                        "statusNumber": 5,

                        "dayOfMonth": 27,

                        "requestId": 177191,

                        "commandName": "/usr/adic/TSM/bin/fsretrieve",

                        "commandStatus": "interim",

                        "statusText": "No retrieve needed, the data is already present on the disk for file /stornext/snfx1/smp2data/soobar1."

                    },

                    {

                        "statusCode": "FS0589",

                        "statusNumber": 589,

                        "dayOfMonth": 27,

                        "requestId": 177191,

                        "commandName": "/usr/adic/TSM/bin/fsretrieve",

                        "commandStatus": "interim",

                        "statusText": "Tertiary Manager software request received."

                    },

                    {

                        "statusCode": "FS0347",

                        "statusNumber": 347,

                        "dayOfMonth": 27,

                        "requestId": 177191,

                        "commandName": "fsretrieve",

                        "commandStatus": "interim",

                        "statusText": "File /stornext/snfx1/smp2data/soobar2 has been retrieved."

                    },

                    {

                        "statusCode": "FS0347",

                        "statusNumber": 347,

                        "dayOfMonth": 27,

                        "requestId": 177191,

                        "commandName": "fsretrieve",

                        "commandStatus": "interim",

                        "statusText": "File /stornext/snfx1/smp2data/soobar3 has been retrieved."

                    },

                    {

                        "statusCode": "FS0347",

                        "statusNumber": 347,

                        "dayOfMonth": 27,

                        "requestId": 177191,

                        "commandName": "fsretrieve",

                        "commandStatus": "interim",

                        "statusText": "File /stornext/snfx1/smp2data/soobar4 has been retrieved."

                    },

                    {

                        "statusCode": "FS0347",

                        "statusNumber": 347,

                        "dayOfMonth": 27,

                        "requestId": 177191,

                        "commandName": "fsretrieve",

                        "commandStatus": "interim",

                        "statusText": "File /stornext/snfx1/smp2data/soobar5 has been retrieved."

                    },

                    {

                        "statusCode": "FS0654",

                        "statusNumber": 654,

                        "dayOfMonth": 27,

                        "requestId": 177191,

                        "commandName": "fsretrieve",

                        "commandStatus": "completed",

                        "statusText": "1 out of 5 files were already on disk."

                    },

                    {

                        "statusCode": "FS0390",

                        "statusNumber": 390,

                        "dayOfMonth": 27,

                        "requestId": 177191,

                        "commandName": "fsretrieve",

                        "commandStatus": "completed",

                        "statusText": "5 out of 5 retrieves were successful."

                    }

                ],

                "footer": {

                    "returnCode": 0,

                    "localDateISOEnd": "2015-10-27T17:05:20",

                    "localDateEnd": "2015-10-27",

                    "localTimeEnd": "17:05:20",

                    "localDayOfWeekEnd": 2,

                    "gmtDateISOEnd": "2015-10-27T23:05:20Z",

                    "gmtDateEnd": "2015-10-27",

                    "gmtTimeEnd": "23:05:20",

                    "gmtDayOfWeekEnd": 2,

                    "elapsedTimeInSeconds": "10.0878"

                }

            },

            {

                "header": {

                    "commandName": "fsretrieve",

                    "commandLine": "/usr/adic/TSM/bin/fsretrieve -F json /stornext/snfx1/smp2data/foobar1 /stornext/snfx1/smp2data/foobar2 /stornext/snfx1/smp2data/foobar3",

                    "commandDescription": "Retrieve files from media and place on disk",

                    "localDateISO": "2015-10-27T17:05:09",

                    "localDate": "2015-10-27",

                    "localTime": "17:05:09",

                    "localDayOfWeek": 2,

                    "gmtDateISO": "2015-10-27T23:05:09Z",

                    "gmtDate": "2015-10-27",

                    "gmtTime": "23:05:09",

                    "gmtDayOfWeek": 2

                },

                "jobInfo": {

                    "job": "25",

                    "exitcode": 0,

                    "datecompleted": "2015-10-27 17:05:26",

                    "state": "COMPLETED"

                },

                "statuses": [

                    {

                        "statusCode": "FS0589",

                        "statusNumber": 589,

                        "dayOfMonth": 27,

                        "requestId": 177192,

                        "commandName": "/usr/adic/TSM/bin/fsretrieve",

                        "commandStatus": "interim",

                        "statusText": "Tertiary Manager software request received."

                    },

                    {

                        "statusCode": "FS0347",

                        "statusNumber": 347,

                        "dayOfMonth": 27,

                        "requestId": 177192,

                        "commandName": "fsretrieve",

                        "commandStatus": "interim",

                        "statusText": "File /stornext/snfx1/smp2data/foobar1 has been retrieved."

                    },

                    {

                        "statusCode": "FS0347",

                        "statusNumber": 347,

                        "dayOfMonth": 27,

                        "requestId": 177192,

                        "commandName": "fsretrieve",

                        "commandStatus": "interim",

                        "statusText": "File /stornext/snfx1/smp2data/foobar2 has been retrieved."

                    },

                    {

                        "statusCode": "FS0347",

                        "statusNumber": 347,

                        "dayOfMonth": 27,

                        "requestId": 177192,

                        "commandName": "fsretrieve",

                        "commandStatus": "interim",

                        "statusText": "File /stornext/snfx1/smp2data/foobar3 has been retrieved."

                    },

                    {

                        "statusCode": "FS0390",

                        "statusNumber": 390,

                        "dayOfMonth": 27,

                        "requestId": 177192,

                        "commandName": "fsretrieve",

                        "commandStatus": "completed",

                        "statusText": "3 out of 3 retrieves were successful."

                    }

                ],

                "footer": {

                    "returnCode": 0,

                    "localDateISOEnd": "2015-10-27T17:05:26",

                    "localDateEnd": "2015-10-27",

                    "localTimeEnd": "17:05:26",

                    "localDayOfWeekEnd": 2,

                    "gmtDateISOEnd": "2015-10-27T23:05:26Z",

                    "gmtDateEnd": "2015-10-27",

                    "gmtTimeEnd": "23:05:26",

                    "gmtDayOfWeekEnd": 2,

                    "elapsedTimeInSeconds": "16.0902"

                }

            }

        ]

    },

    {

        "pendingJobList": [

            {

                "jobInfo": {

                    "job": "30",

                    "positioninagentqueue": 1,

                    "exitcode": 0,

                    "state": "QUEUED"

                }

            }

        ]

    }

]

Perl

See Sample Perl Script.

Python

See SamplePython Script.