REST API - submitting a job with dependencies in the current plan
Use REST APIs to submit a job with a single dependency in the plan.
About this task
This process involves retrieving the unique IDs of two jobs (a successor and a predecessor) and then creating a dependency between them using a POST REST API.
Procedure
-
First, get the unique ID of the successor job. Use the
GET/twsd/api/v2/model/jobdefinition endpoint to find its
definition in the database.
You can query for the job definition using either model filters or OQL. The following substeps show how to retrieve a job definition named TESTJOB.
-
Next, get the data for the predecessor job. Use the
GET/twsd/api/v2/plan/job endpoint to find the job
currently in the plan.
-
Now, use the data you retrieved to add the dependency with the
POST/twsd/api/v2/plan/job/{job_id}/action/add-dependencies
endpoint.
The API returns a success message, and the dependency is now active in the current plan.
- To verify the dependency was added, run the GET/twsd/api/v2/plan/job/{job_id} API endpoint, using the ID of the successor job. Examine the dependencies object in the response body to confirm it is correct.