Start and test the REST API

How to start and test the REST server on IBM Spectrum® Archive Enterprise Edition.

About this task

Because the REST server runs on httpd, you can use a standard systemctl command to control the REST server.

Procedure

  1. Restart and reload the httpd service to enable the REST server, by using the following command:
    systemctl restart httpd
  2. Test the access to the server by using the following command:
    curl -i -XGET 'http://localhost:7100/ibmsa/v1'
    The following example shows the output from the command:
    [root@glues tmp]# curl -XGET -i 'http://localhost:7100/ibmsa/v1/'
    HTTP/1.0 200 OK
    Content-Type: text/html; charset=utf-8
    Content-Length: 22
    Server: Werkzeug/0.11.15 Python/2.7.5
    Date: Fri, 03 Mar 2017 03:16:22 GMT
    IBMSA-REST is working.
  3. The following examples show additional commands and their output.
    Command for default tape drive information.
    curl -XGET 'http://localhost:7100/ibmsa/v1/drives'
    Output:
    [root@spectrumscale ~]# curl -XGET 'http://localhost:7100/ibmsa/v1/drives'
    [{"address":256,"id":"VDRIVE0000","library_id":"0000VLIBRARY_LL0","library_name":"lib1","node_hostname":"spectrumscale",
    "node_id":1,"nodegroup_name":"G0","role":"mrg","status":"Not mounted","tape_barcode":"","type":"LTO5"},
    {"address":257,"id":"VDRIVE0001","library_id":"0000VLIBRARY_LL0","library_name":"lib1",
    "node_hostname":"spectrumscale","node_id":1,"nodegroup_name":"G0","role":"mrg","status":"Not mounted",
    "tape_barcode":"","type":"LTO5"},
    {"address":258,"id":"VDRIVE0002","library_id":"0000VLIBRARY_LL0","library_name":"lib1","node_hostname":"spectrumscale",
    "node_id":1,"nodegroup_name":"G0","role":"mrg","status":"Not mounted","tape_barcode":"","type":"LTO5"},
    {"address":259,"id":"VDRIVE0003","library_id":"0000VLIBRARY_LL0","library_name":"lib1","node_hostname":"spectrumscale",
    "node_id":1,"nodegroup_name":"G0","role":"mrg","status":"Mounted","tape_barcode":"VTAP03L5","type":"LTO5"}]
    
    Command that displays information about the tape drive that is specified in the URL (VDRIVE0003, in this example).
    curl -XGET 'http://localhost:7100/ibmsa/v1/drives/VDRIVE0003'
    Output:
    [root@spectrumscale ~]# curl -XGET 'http://localhost:7100/ibmsa/v1/drives/VDRIVE0003'
    {"address":259,"id":"VDRIVE0003","library_id":"0000VLIBRARY_LL0","library_name":"lib1","node_hostname":"spectrumscale",
    "node_id":1,"nodegroup_name":"G0","role":"mrg","status":"Mounted","tape_barcode":"VTAP03L5","type":"LTO5"}
    Command that displays information about a specific tape drive, but in human readable format.  The key/value pairs are displayed in two columns, with the pretty parameter.
    curl -XGET 'http://localhost:7100/ibmsa/v1/drives/VDRIVE0003?pretty'
    Output
    [root@spectrumscale ~]# curl -XGET 'http://localhost:7100/ibmsa/v1/drives/VDRIVE0003?pretty'
    {
      "address": 259,
      "id": "VDRIVE0003",
      "library_id": "0000VLIBRARY_LL0",
      "library_name": "lib1",
      "node_hostname": "spectrumscale",
      "node_id": 1,
      "nodegroup_name": "G0",
      "role": "mrg",
      "status": "Mounted",
      "tape_barcode": "VTAP03L5",
      "type": "LTO5"
    }
    Command that displays information about a specific tape drive, and also filters the output by specifying certain fields with the fields= parameter.
    curl -XGET 'http://localhost:7100/ibmsa/v1/drives/VDRIVE0003?pretty&fields=id,type'
    Output:
    [root@spectrumscale ~]# curl -XGET 'http://localhost:7100/ibmsa/v1/drives/VDRIVE0003?pretty&fields=id,type'
    {
      "id": "VDRIVE0003",
      "type": "LTO5"
    }
    Command that displays information about all tape drives, and also filters the output by specifying certain fields with the fields= parameter.
    curl -XGET 'http://localhost:7100/ibmsa/v1/drives?pretty&fields=id,type'
    Output:
    [root@spectrumscale ~]# curl -XGET 'http://localhost:7100/ibmsa/v1/drives?pretty&fields=id,type'
    [
      {
        "id": "VDRIVE0000",
        "type": "LTO5"
      },
      {
        "id": "VDRIVE0001",
        "type": "LTO5"
      },
      {
        "id": "VDRIVE0002",
        "type": "LTO5"
      },
      {
        "id": "VDRIVE0003",
        "type": "LTO5"
      }
    ]