Delphix Products

 View Only
  • 1.  API for linking Data Sources and sync data with SQL server

    Posted 02-24-2023 03:00:00 PM

    I want to automate the process of linking Source database to target enviornment in delphix engine with the help of API's. 

    As there are manual steps to do that, i want to automate it by API's, i am requesting if anyone can help on that



    ------------------------------
    Abhishek Ramesh babu
    Cloud Automation Engineer - Delphix
    Credit Suisse AG
    ------------------------------


  • 2.  RE: API for linking Data Sources and sync data with SQL server

    Posted 02-24-2023 03:33:00 PM

    Hi Abhishek,

    I think you might find a very good start here in this thread about using the dxToolkit for a similar request: https://community.delphix.com/discussion/snapsynch-creation-using-dxtoolkit-for-mssql-db. 

    Let me know if that helps.

    Thanks,

    Michael



    ------------------------------
    Michael Torok
    Digital Customer Experience, Senior Director
    Delphix
    ------------------------------



  • 3.  RE: API for linking Data Sources and sync data with SQL server

    Posted 02-27-2023 07:30:00 AM

    Thank Michael for your quick response.



    ------------------------------
    Abhishek Ramesh babu
    Cloud Automation Engineer - Delphix
    Credit Suisse AG
    ------------------------------



  • 4.  RE: API for linking Data Sources and sync data with SQL server
    Best Answer

    Posted 02-27-2023 09:25:00 AM

    Hi  Abhishek, 

    here the steps and endpoints for Create the D-source through API

    1. Create session
    2.  Get Authenticate
    3. Create source environment if not exist
    4. Get SourceConfig reference of Database being onboard
      sourceconfiglist=$(curl -b $cookies_Login -sX GET --header 'Content-Type: application/json' -k "https://${dlpx_engine}/resources/json/delphix/sourceconfig")
    5. link the source
      linkpayload="{
          "\"type"\": "\"LinkParameters"\",
          "\"name"\": "\"$sourcedbname"\",
          "\"group"\": "\"$SourceGroupReference"\",
          "\"linkData"\": {
              "\"type"\": "\"MSSqlLinkData"\",
              "\"config"\": "\"$sourceconfigref"\",
              "\"sourcingPolicy"\": {
                  "\"type"\": "\"SourcingPolicy"\",
                  "\"logsyncEnabled"\": false
              },
              "\"sharedBackupLocations"\": [ 	],
              "\"syncParameters"\": {
                  "\"type"\": "\"MSSqlNewCopyOnlyFullBackupSyncParameters"\",
                  "\"compressionEnabled"\": true,
                  "\"backupPolicy"\": "\"PRIMARY"\"
              },
              "\"mssqlUser"\": {
                  "\"type"\": "\"MSSqlEnvironmentUser"\",
                  "\"user"\": "\"$TargetEnvironmentprimaryuser"\"
              },
              "\"pptRepository"\": "\"$TarepositoryReference"\",
      		"\"pptHostUser"\": "\"$TargetEnvironmentprimaryuser"\",
              "\"ingestionStrategy"\": {
                  "\"type"\": "\"DelphixManagedBackupIngestionStrategy"\",
      			"\"compressionEnabled"\": true,
                  "\"backupPolicy"\": "\"PRIMARY"\"
              }
          }
      }"
      
      	d_source=`curl -b $cookies_Login -sX POST --header 'Content-Type: application/json' -d "$linkpayload"  -k "${VIRTUALIZATION_ENGINE}/database/link"`


    ------------------------------
    Vijayender Singidi
    ------------------------------



  • 5.  RE: API for linking Data Sources and sync data with SQL server

    Posted 02-27-2023 01:35:00 PM

    Hi Vijayender,

    Thank for you response.

    Can i use the same API for creating  Enviornment and target.



    ------------------------------
    Abhishek Ramesh babu
    Cloud Automation Engineer - Delphix
    Credit Suisse AG
    ------------------------------



  • 6.  RE: API for linking Data Sources and sync data with SQL server

    Posted 02-27-2023 02:48:00 PM

    Hi, 

    for creating environments you have execute different payload at endpoint , you  can generate api payload through CLi by setting "setopt trace=true"

    $EnvironmentPayload = "{
                \"type\": \"HostEnvironmentCreateParameters\",
                \"primaryUser\": { 
    				\"type\": \"EnvironmentUser\", 
    				\"name\": \"${EnvironmentUserName}\",
    				\"credential\": {
    					\"type\": \"PasswordCredential\", 
    					\"password\": \"${EnvironmentPassword}\" 
    				}, 
    				\"environment\" : \"$StagEnviRef\" },
                \"hostEnvironment\": { 
    				\"type\": \"WindowsHostEnvironment\", 
    				\"name\": \"${Envi_Name}\", 
    				\"proxy\": \"${proxyref}\" }, ## staging environmen's host reference 
                \"hostParameters\": { 
    				\"type\": \"WindowsHostCreateParameters\", 
    				\"host\": { 
    					\"type\": \"WindowsHost\", 
    					\"address\": \"$Envi_Address\" 
    				} 
    			}   
            }"
    
    	CREATE_ENVIRONMENT=$(curl -b $cookies_Login -sX POST --header 'Content-Type: application/json' -d "${environment_payload}"  -k "https://${dlpx_engine}/resources/json/delphix/environment")


    ------------------------------
    Vijayender Singidi
    ------------------------------



  • 7.  RE: API for linking Data Sources and sync data with SQL server

    Posted 02-28-2023 06:55:00 AM

    Thank you Vijayender,I wil check on this



    ------------------------------
    Abhishek Ramesh babu
    Cloud Automation Engineer - Delphix
    Credit Suisse AG
    ------------------------------