Provision a Oracle VDB through API call

  • 0
  • 1
  • Question
  • Updated 2 weeks ago
  • Answered
Hi there, I am trying to Provision a Oracle VDB through an API call. My code is something like:
#DB Provision

curl -vs -X POST -k --data @- https:/URL/resources/json/delphix/database/provision \

        -b cookies.txt -H "Content-Type: application/json" <<EOF

{

.

.

}

EOF

I am getting an error:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>Error 403</title></head><body><h1>Error processing request</h1><p>HTTP status: 403</p><p>Message: Use &#47;resources&#47;json&#47;delphix&#47;login to log in first</p><p>Request was POST /resources/json/delphix/database/provision</p></body></html>

My login and session is okay, I have have done a lot of other posts already.

Can you please assist?

Photo of EnterpriseMan

EnterpriseMan

  • 302 Points 250 badge 2x thumb

Posted 2 weeks ago

  • 0
  • 1
Photo of Adam Bowen

Adam Bowen, Official Rep

  • 17,744 Points 10k badge 2x thumb
Make sure your authentication call writes the cookie again. There was a recent change to Delphix where you get a new jsessionid cookie after you successfully authenticate. Look closely at #2 below

#!/bin/bash
DEIP="delphixengine"
USER="delphix_admin"
PASS="landshark"

# 1) Create Delphix API Session
echo -e "\n\nCreating Session\n"
curl -s -X POST -k --data @- http://${DEIP}/resources/json/delphix/session \
-c cookies.txt -H "Content-Type: application/json" <<EOF
{
"type": "APISession",
"version": {
"type": "APIVersion",
"major": 1,
"minor": 7,
"micro": 0
}
}
EOF

# 2) Delphix Login
echo -e "\n\nLogging in\n"
curl -s -X POST -k --data @- http://${DEIP}/resources/json/delphix/login \
-b cookies.txt -c cookies.txt -H "Content-Type: application/json" <<EOF
{
"type": "LoginRequest",
"username": "${USER}",
"password": "${PASS}"
}
EOF
#3) List containers
echo -e "\n\nGrabbing list of containers\n"
curl -X GET -k "http://${DEIP}/resources/json/delphix/jetstream/container"; -b cookies.txt -H "Content-Type: application/json"

echo -e "\n\nCurl Script Complete\n"
Photo of EnterpriseMan

EnterpriseMan

  • 302 Points 250 badge 2x thumb
Hi Adam,
Thanks for the swift response, works like charm now. Great!!