REST API - retrieving the predecessors of a job stream from the database

Use REST APIs to retrieve the list of a job stream predecessors from the database.

About this task

This process involves retrieving a job stream definition through a GET REST API and then inspecting its various dependency arrays, such as externalPredecessors, in the response body.

Procedure

  1. First, get the definition of the job stream for which you want to find predecessors. Use the GET/twsd/api/v2/model/jobstream endpoint.
    1. In the Swagger UI, expand the endpoint. Use the query filters or the oql string parameter to locate your target job stream.
    2. Click Execute.
    3. From the API response, locate the various dependency arrays within the definition, such as externalPredecessors and promptDependencies. These arrays contain the identifiers of the predecessor objects.

      Example of a response payload showing dependency arrays:

      {
        "kind": "JobStream",
        "key": "/RMMYCLDTL42671_1#/TESTJS3",
        "def": {
          "id": "0168fa4e-3d7e-390c-a58d-49ca32fabc78",
          "abstractId": "e8cb402b-d1a6-3618-97d7-d0f3eb309796",
          "folderId": "742ba6a6-31aa-3051-b810-3ced4fc624b4",
          "folder": "/",
          "name": "TESTJS3",
          "workstationId": "62420b07-726c-3f5a-ae3a-df9a170c7626",
          "workstation": "/RMMYCLDTL42671_1",
          "options": [],
          "saturdayIsFree": true,
          "sundayIsFree": true,
          "runCycles": [],
          "exclusiveRunCycles": [],
          "asap": true,
          "perJobLatestStart": false,
          "matchingCriteria": {
            "type": "sameDay"
          },
          "externalPredecessors": [
            {
              "jobStreamAbstractId": "74795642-e468-3d11-90ed-c440478f8c56",
              "workstation": "/RMMYCLDTL42671_1",
              "jobStream": "/TESTJS2"
            },
            {
              "jobAbstractId": "c11b99fc-47d7-3f5c-927b-bafb8302c9fd",
              "workstation": "/RMMYCLDTL42671_1",
              "jobStream": "/TESTJS2",
              "jobName": "ALELS"
            }
          ],
          "joinConditions": [],
          "interNetworkDependencies": [],
          "promptDependencies": [],
          "fileDependencies": [],
          "resourceDependencies": [],
          "jobs": [
            {
              "id": "3317da2c-c5e8-3f89-b8a1-ec5082844894",
              "abstractId": "d67e427b-3820-3ec0-a4f4-abff2facf665",
              "name": "ALELS",
              "externalPredecessors": [
                {
                  "jobAbstractId": "fe50e5c7-9084-32d2-a9e0-cf8e33c5ca47",
                  "workstation": "/RMMYCLDTL42671_1",
                  "jobStream": "/TESTJS",
                  "jobName": "SLEEP"
                }
              ],
              "internalPredecessors": [],
              "joinConditions": [],
              "interNetworkDependencies": [],
              "promptDependencies": [
                {
                  "globalPromptId": "5ab0a0cf-094a-3d4d-a94a-f059e0dae65d",
                  "globalPrompt": "TESTP"
                }
              ],
              "fileDependencies": [],
              "resourceDependencies": []
            }
          ]
        }
      }
  2. For each predecessor identified in the dependency arrays, use its unique ID to retrieve its full definition.
    1. To get a predecessor job definition, use the GET/twsd/api/v2/model/jobdefinition/{job_abstract_id} endpoint, pasting the jobAbstractId into the ID parameter.
    2. To get a predecessor job stream definition, use the GET/twsd/api/v2/model/jobstream/{jobstream_abstract_id} endpoint, pasting the jobStreamAbstractId into the ID parameter.
    3. Click Execute for each request.
    The response for each call contains the detailed definition for that specific predecessor object. Repeat this process for every dependency to get the complete list of predecessors.