Views:

Summary


With DPX 4.5.5 OVA and later a new REST interface has been added which can be used to control and query various aspects of the DPX server.

 

 

Step By Step


Below is an description on how to start a job instance from a script or CLI using DPX RESTAPI. This description uses curl and assumed the jq (jason parser) is installed on a Linux machine in a BASH shell

1) The First step is to get an authorization token, I am getting the token by authenticating rest and putting the token header  in a variable(token) for later use using the following command

 

 

 

 

token="Authorization: Bearer $( curl --location --request POST 'http://<MASTERIP>/auth/login' --header 'Content-Type: application/json' --data-raw '{"username": "sysadmin","password": "<YOURPASSWORD>"}'|jq -r .refreshToken )"

2)  Next step is to start a new instance of the job using a POST to the /job_instances endpoint and passing the following values via the request body:

job_instance_command_name - START, CANCEL etc
retention_days - Number of days to retain the catalog after completion.
job - Name of the job
job_instance_run_type - The type of this job_instance (e.g., BASE, DIFR, INCR) Always INCR for Agentless

 

curl --location --request post 'http://<MASTERIP>/app/api/job_instances' --header "$token" --header 'Content-Type: application/json' --data-raw '{ "job_instance_command_name": "START","retention_days": 1,"job": "<YOURJOB>","job_instance_run_type": "INCR"}'| jq
Add a comment