APIPythonOpen-Source Solutions

 View Only
  • 1.  Delphix automation using REST

    Posted 02-14-2019 04:39:00 PM
    I am new to using REST.  I am confortable using delphix CLI to sutomate. However , can't see what is wrong with my rest program. 

    Here is the code :


    # Create API session
    echo "Initiate Session "

    curl -s -S -X POST -k --data @- \
    -c ~/cookies.txt -H "Content-Type: application/json" <<EOF
     "type": "APISession",
     "version": {
     "type": "APIVersion",
     "major": 1,
     "minor": 7,
     "micro": 0

    echo "Initiated Session"

    # login
    curl -s -S -X POST -k --data @- \
     -b ~/cookies.txt -H "Content-Type: application/json" <<EOF
     "type": "LoginRequest",
     "username": "amathe01",
     "password": djsdlfjdo_23"

    # List ENV
    echo "\n\n List Env Information"
    curl -S -X GET -k \
     -b ~/cookies.txt -H "Content-Type: application/json"


    When executing the script it only executed the first CURL and returns to command prompt. 
    However, I can execute each command from the script on the command line and get the 
    expected output. What am I missing?

    Here is the output :
    Initiate Session

    A second question. Is there way not to send clear test password to the login request? Delphix CLI provides an encryption mecahnism. 

    Thanks in advance !


  • 2.  RE: Delphix automation using REST

    Posted 02-14-2019 05:04:00 PM
    Start by looking at my example here:https://community.delphix.com/delphix/topics/provision-a-oracle-vdb-through-api-call

    To your second question, you are using curl in your rest calls. Here is an article that speaks to how to pass passwords to curl commands: https://stackoverflow.com/questions/2594880/using-curl-with-a-username-and-password

    You would also need toResearch how toUse SSL with curl If you don't want to transmit information in plaintext.

    If you're just doing some ad hoc scripts for yourself,Then maybe this is worthwhile.But, if you're going to do actual enterprise automation,You should really look into using a robust programming language like Python or golang

  • 3.  RE: Delphix automation using REST

    Posted 02-14-2019 05:47:00 PM
    Thank you Adam ! Perfect !!