Creating data set components from z/OS system with REST APIs
Learn about the steps to create components from IBM® Z data sets 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'
The following response is displayed.{"expiration":1516202935577,"username":"ZOSUSER","password":"ZOSPW","token":"VVNFUjM1NTE4ODczMjY3NjU=","port":22}
-
Call the REST API to get the information on data sets that match a specific filter pattern from
a specific 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":"cm9vdC0xMzM5NzAzMjQ2","hostname":"YOUR_Z_OS_HOST_NAME","port":22} ' 'https://your_tools_server_host_name:9443/ZVDTREST/zvdtrs/z-services/listZosDatasets?hostName=YOUR_Z_OS_HOST_NAME&filter=SYS1.**&sshPort=22'
The following response is displayed.[{"id":0,"name":"SYS1.A39AAA.LPALIB","zosType":"Non-VSAM"},{"id":0,"name":"SYS1.A45.LINKLIB","zosType":"Non-VSAM"},{"id":0,"name":"SYS1.A45AAA.LINKLIB","zosType":"Non-VSAM"},{"id":0,"name":"SYS1.ADFMAC1","zosType":"Non-VSAM"},…]
- Create the component by including your selected data sets returned from above call. Put
the token from the first call into the authorization header.
curl -k -u zvdtadmin:password -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'SSHAuthorization: {"token":"dXNlcjM1NTg5OTg4OTgwNA==","hostname":"YOUR_Z_OS_HOST_NAME","port":22} '-d '{ "name": "testDsComp-fromLinux", "zSystem": { "hostname": "YOUR_Z_OS_HOST_NAME", "port": 22 }, "systemType": "COMP_SYSTEM_TYPE_ZSYSTEM_USER", "description": "ds_comp", "dataSets": [ { "name": "SYS1.A39AAA.LPALIB" }, { "name": "SYS1.AFOMMOD1" }, { "name": "SYS1.A45AAA.LINKLIB"} ], "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/zosDatasetComponent