How do i know if a VDB refresh kicked off through the VDB refresh API was successful or a failure?

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • Answered
Hi,

I am using the VDB refresh API to kick off a VDB refresh. The API sends a JSON output in the following format;

{    "type": "OKResult",
    "status": "OK",
    "result": "",
    "job": "JOB-12345",
    "action": "ACTION-54321"
}

How do i know if the Job with the Job ID i obtained above is a success or a failure?

Is there any other API to poll the status/result of the Job using the Job ID?
Photo of Shamanth Hanchate

Shamanth Hanchate

  • 210 Points 100 badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of Mouhssine SAIDI

Mouhssine SAIDI

  • 4,732 Points 4k badge 2x thumb
Hi,

Use this URL to get job progress/status (http://delphixengineip/api/#job) you have to passe the Job reference to it that and read the object from the Delphix engine:

curl -X GET -k "http://${DE}/resources/json/delphix/j..." -b ~/cookies.txt -H "Content-Type: application/json"

This will return the job object, you have to look on properties : jobState and percentComplete

Regards,

Mouhssine
Photo of Mouhssine SAIDI

Mouhssine SAIDI

  • 4,732 Points 4k badge 2x thumb
Hi,

Please find here a snipt of code in bash to check and loop on job status until finished

while [ $jobState = "RUNNING" ]
do
sleep 1
result=$(curl -s -X GET -k http://${engine}/resources/json/delph... \
-b ~/cookies.txt -H "Content-Type: application/json")

# Get everything in the result that comes after job.
temp=${result#*\"jobState\":\"}
# Get rid of everything after
jobState=${temp%%\"*}

done

if [ $jobState = "COMPLETED" ]
then
echo "successfully Job execution"
else
echo "unable to complete the job correctly"
echo result
fi

}

Regards,

Mouhssine
Photo of Shamanth Hanchate

Shamanth Hanchate

  • 210 Points 100 badge 2x thumb
Hi,

Where do we pass the JOB ID ?

Running in the format in the below example doesn't work

curl -X GET -k "http:${DE}/resources/json/delphix/JOB-12345"; -b ~/cookies.txt -H "Content-Type: application/json"
Photo of Mouhssine SAIDI

Mouhssine SAIDI

  • 4,732 Points 4k badge 2x thumb
Hi,

The URL isn't the correct one use this one instead

curl -X GET -k "http:${DE}/resources/json/delphix/job/JOB-12345"; -b ~/cookies.txt -H "Content-Type: application/json"

Regards,

Mouhssine
Photo of Shamanth Hanchate

Shamanth Hanchate

  • 210 Points 100 badge 2x thumb
Hi,

Thank you for your help and updating the URL. This works perfectly to get the status of any job. 
Photo of Mouhssine SAIDI

Mouhssine SAIDI

  • 4,732 Points 4k badge 2x thumb

Hi,


happy to know that it works for you.


Rgards,


Mouhssine