Running backup and restore tasks on the command-line or REST interface

You can use the command-line interface or REST interface for more backup and restore tasks that are not available on the graphical user interface.

About this task

Before you begin, obtain the password. Your role must have permissions to back up or to restore files.

Procedure

  1. Go to the appropriate page or directory.
    • Command-line interface
      1. Go to the <WAS_HOME>/bin directory. For example,
        Windows
        cd drive:\Program Files\IBM\WebSphere\AppServer\bin
        Linux
        cd /opt/IBM/WebSphere/AppServer/bin
      2. Start the wsadmin interface by using an authorized user ID, such as SKLMAdmin. For example,
        Windows
        wsadmin.bat -username SKLMAdmin -password mypwd -lang jython
        Linux
        ./wsadmin.sh -username SKLMAdmin -password mypwd -lang jython
    • REST interface:
      • Open a REST client.
  2. Complete the task.
    • Command-line interface:
      tklmBackupGetProgress

      Type tklmBackupGetProgress to determine the current phase of a backup task that is running. For example, type:

      print AdminTask.tklmBackupGetProgress()
      tklmBackupGetRestoreProgress

      Type tklmBackupGetRestoreProgress to determine the current phase of a restore task that is running. For example, type:

      print AdminTask.tklmBackupGetRestoreProgress()
      tklmBackupGetRestoreResult

      Type tklmBackupGetRestoreResult to determine the success or failure of a completed restore task. For example, type:

      print AdminTask.tklmBackupGetRestoreResult()
      tklmBackupGetResult

      Type tklmBackupGetResult to determine the success or failure of a completed backup task. For example, type:

      print AdminTask.tklmBackupGetResult()
      tklmBackupIsRestoreRunning

      Type tklmBackupIsRestoreRunning to determine whether the restore task is running. For example, type:

      print AdminTask.tklmBackupIsRestoreRunning()
      tklmBackupIsRunning

      Type tklmBackupIsRunning to determine whether the backup task is running. For example, type:

      print AdminTask.sklmBackupIsRunning()
      tklmBackupList

      Type tklmBackupList to list the backup files in a directory. For example, type:

      print AdminTask.tklmBackupList 
      	('[-backupDirectory C:\\sklmbackup1 -v y]')
    • REST interface:
      1. Obtain a unique user authentication identifier to access IBM® Security Key Lifecycle Manager REST services. For more information about the authentication process, see Authentication process for REST services.
      2. To invoke the REST service, send the HTTP request. Pass the user authentication identifier that you obtained in Step a along with the request message as shown in the following example.
        Backup Get Progress REST Service
        Use Backup Get Progress REST Service to determine the current phase of a backup task that is running. For example, you can send the following HTTP request:
        GET https://localhost:<port>/SKLM/rest/v1/ckms/backups/progress
        Content-Type: application/json
        Accept : application/json
        Authorization: SKLMAuth authId=139aeh34567m
        Accept-Language : en
        Backup Get Restore Progress REST Service
        Use Backup Get Restore Progress REST Service to determine the current phase of a restore task that is running. For example, you can send the following HTTP request:
        GET https://localhost:<port>/SKLM/rest/v1/ckms/restore/progress
        Content-Type: application/json
        Accept: application/json
        Authorization: SKLMAuth authId=139aeh34567m
        Accept-Language: en
        Backup Get Restore Result REST Service
        Type Backup Get Restore Result REST Service to determine the success or failure of a completed restore task. For example, you can send the following HTTP request:
        GET https://localhost:<port>/SKLM/rest/v1/ckms/restore/result
        Content-Type: application/json
        Accept : application/json
        Authorization: SKLMAuth authId=139aeh34567m
        Accept-Language : en
        Backup Get Result REST Service
        Type Backup Get Result REST Service to determine the success or failure of a completed backup task. For example, you can send the following HTTP request:
        GET https://localhost:<port>/SKLM/rest/v1/ckms/backups/result
        Content-Type: application/json
        Accept : application/json
        Authorization: SKLMAuth authId=139aeh34567m
        Accept-Language : en
        Backup List REST Service
        Use Backup List REST Service to list the backup files in a directory. For example, you can send the following HTTP request:
        GET https://localhost:<port>/SKLM/rest/v1/ckms/backups?backupDirectory=
        /sklmbackup
        Content-Type: application/json
        Accept : application/json
        Authorization: SKLMAuth authId=139aeh34567m
        Accept-Language : en