Creating volume components from z/OS system with REST APIs
Learn about the steps to create components from IBM Z® volumes by using REST API.
- Call the REST API to authenticate the SSH connection to the z/OS® system.
curl -k -u zvdtadmin:password -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "system-uuid": "systemuuid", "username": "zosuser", "password": "zospw"}' 'https://your_tools_server_host_name:9443/ZVDTREST/zvdtrs/auth-services/v3/authenticate-ssh'
- Call the REST APIs to get the information on all volumes for the z/OS system. Put the token from above call into the authorization header.
curl -k -u zvdtadmin:password -X GET --header 'Accept: application/json' --header 'SSHAuthorization: {"token":"VVNFUjM1NTE4MTkwMzg4MzI=","hostname":"YOUR_Z_OS_HOST_NAME","port":22}' 'https://your_tools_server_host_name:9443/ZVDTREST/zvdtrs/z-services/listZosVolumes?hostName=YOUR_Z_OS_HOST_NAME&sshPort=22'
The following response is displayed.[{"id":0,"name":"A27AAA","extractionTime":"1960-01-01 23:03:20","deviceNumber":"048C","deviceType":"3390","progress":0,"compressed":0,"size":1892010960},{"id":0,"name":"A27CCC","extractionTime":"1960-01-01 23:03:20","deviceNumber":"04BE","deviceType":"3390","progress":0,"compressed":0,"size":2838016440},{"id":0,"name":"A45SYS","extractionTime":"1960-01-01 23:03:20","deviceNumber":"0492","deviceType":"3390","progress":0,"compressed":0,"size":8514049320},…]
- Create the component by including your selected volumes that are returned from above
call.
curl -k -u zvdtadmin:password -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'SSHAuthorization: {"token":"VVNFUjM1NTE4MTkwMzg4MzI=","hostname":"YOUR_Z_OS_HOST_NAME","port":22} ' -d '{ "name": "testComp-fromLinux", "version":1, "zSystem": { "hostname": "YOUR_Z_OS_HOST_NAME", "port": 22 }, "systemType": "COMP_SYSTEM_TYPE_ZSYSTEM_ENV", "description": "comp_desc", "volumes": [ { "name": "A27AAA" } , { "name": "MVS220" } ] , "schedules":{"originalScheduleTime": "2018-01-06 13:01:00.0","originalScheduleTimezoneId": "CTT"}, "concurrentExtractionNumber": 3, "ftpSystem": {"hostname": "your.image.storage.com"} }' 'https://your_tools_server_host_name:9443/ZVDTREST/zvdtrs/componentServices/v2/zosVolumeComponent'