Creating Db2 components from z/OS system with REST APIs

Learn about the steps to create Db2® components from z/OS® system by using the REST API.

Procedure

  1. Call the REST API to authenticate the SSH connection to the z/OS system.
    curl -k -u zdtadmin: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/ZDTREST/zdtrs/auth-services/v3/authenticate-ssh'
    The following response is displayed.
    {"token":"cm9vdC02NjQ3ODgxMTY="}
  2. Obtain the list of Db2 subsystems from the z/OS system by passing the uuid of the z/OS system.
    curl -k -u zdtadmin:password -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' 'https://your_tools_server_host_name:9443/ZDTREST/zdtrs/source-env-services/db2-subsystem?uuid=abb1b85a-c148-4628-bfe8-749c6751c5b8'

    After the request is complete, the following JSON response with a list of subsystems is displayed.

    [
        {
            "uuid": "4c52d3e0-1a0b-4b6e-898f-38f1db4286a0",
            "creation-time": 1563540882793,
            "subsystem-id": "DC1A",
            "subsystem-location": "DC1A",
            "sdsnexit": "SYS1.DC1A.SDSNEXIT",
            "sdsnload": "SYS1.DC1A.SDSNLOAD",
            "run-lib": "",
            "use-admin": true,
            "admin-program": "ADB2GEN",
            "admin-plan": "adb2gen",
            "admin-program-lib": "DSN.TOOLS.ADB1201.SADBLLIB"
        },
        {
            "uuid": "e729459a-2540-46f2-ab3d-cfcf5f20bb76",
            "creation-time": 1602103833447,
            "subsystem-id": "DB1E",
            "subsystem-location": "DB1E",
            "sdsnexit": "SYS1.DB1E.SDSNEXIT",
            "sdsnload": "SYS1.DB1E.SDSNLOAD",
            "run-lib": null,
            "use-admin": true,
            "admin-program": null,
            "admin-plan": "ADB2GEN",
            "admin-program-lib": "DSN.TOOLS.ADB1201.SADBLLIB"
        }
    ]
  3. Obtain the list of schemas by using the subsystem ID with the hostname, and port of the z/OS system, providing the authentication to the z/OS system.
    curl -k -u zdtadmin:password -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'SSHAuthorization: {"token":"cm9vdC0xMzM5NzAzMjQ2","hostname":"your_zsystem_host_name","port":22}' 'https://your_tools_server_host_name:9443/ZDTREST/zdtrs/db2/v1/schemas?hostName=your_zsystem_host_name&sshPort=22&subsystemName=DC1A

    After the request is complete, the list of schema names is displayed.

    ["ADB","CLARKG","DSN8110","DSN81110","DSN811SA","DSN8BQRY","DSNRGCOL","IBMUSER","Q","RUNSTATS","SYSIBM","SYSIBMTS","SYSTOOLS"]
  4. Obtain the list of artifacts by passing the schema name with the hostname, port, and subsystem ID of the z/OS system, and providing the authentication to the z/OS system.
    curl -k -u zdtadmin:password -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'SSHAuthorization: {"token":"cm9vdC0xMzM5NzAzMjQ2","hostname":" your_zsystem_host_name","port":22}' 'https://your_tools_server_host_name:9443/ZDTREST/zdtrs/db2/v1/schemas/your_schema_name?hostName=your_zsystem_host_name&sshPort=2022&subsystemName=your_subsystem_id''
    After the request is complete, the list of Db2 tables is displayed.
    [{"id":0,"name":"PLAN_TABLE","tableType":"TABLE","schema":{"id":0,"name":"CLARKG"},"database":{"id":0,"name":"DSN00022"},"tableSpaceSize":720,"allocatedTableSpaceSize":0,"unsupportReason":null,"tableSpaceName":"PLANRTAB","creationTime":null,"subSystem":null,"addedByUser":false}]
  5. Create a Db2 component by using the obtained list of the selected Db2 tables, subsystem ID, the hostname, and port of the z/OS system, providing the authentication to the z/OS system. If you have a DDL file, you must specify the path to the DDL file in the Db2DDL parameter.
    curl -k -u zdtadmin:password -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'SSHAuthorization: {"token":"cm9vdC0xMzM5NzAzMjQ2","hostname":" your_zsystem_host_name","port":22}' -d '{"name":"test","version":1, "systemType":"COMP_SYSTEM_TYPE_ZSYSTEM_USER","zSystem":{"hostname":"your_zSystem_host_name","port":2022},"description":"test","ftpSystem":{"hostname":"your_ftp_system_host_name"},"concurrentExtractionNumber":"1","subsystemName":"your_subsystem_id","selectedTables":[{"name":"PLAN_TABLE","tableType":"TABLE","schemaName":"your_db2_schema_name","databaseName":"your_db2_database_name"}],"integrity":true,"db2DDL":""}'
    'https://your_tools_server_host_name:9443/ZDTREST/zdtrs/componentServices/v1/db2'