REST API - submitting a job stream in the current plan

Use REST APIs to submit a job stream in the plan.

About this task

This process involves retrieving a job stream's ID through a GET REST API and then submitting it into the current plan through a POST REST API.

Procedure

  1. First, get the unique ID of the job stream you want to submit. Use the GET/twsd/api/v2/model/jobstream endpoint to find your job stream.

    You can query for the job stream using either model filters or OQL. The following substeps show how to retrieve a job stream named JS-API.

    1. To query with model filters: use a syntax analogous to the composer syntax. For the example job stream, use the following syntax: /@/@#/@/JS-API.
    2. To query with OQL: from the dropdown menu, select Filter by exact name and matching folder and sort results in name descending order in the OQL string parameter field. Enter the name of the job stream in the name field to obtain the following query: name = 'JS-API' AND folder LIKE '/' ORDER BY name DESC.
    3. After selecting a query method, click Execute.
    4. From the API response, copy and save the job stream id.

      Example of a response payload:

      {
        "count": 1,
        "results": [
          {
            "kind": "JobStream",
            "key": "/WA_DA#/JS-API",
            "def": {
              "id": "26dc6d8d-5cff-4002-8346-8027ea50f81c",
              "abstractId": "26300eb5-547c-46a1-b450-fab39fe0d4a9",
              "folderId": "742ba6a6-31aa-3051-b810-3ced4fc624b4",
              "folder": "/",
              "name": "JS-API",
              "workstationId": "f2e69991-a64a-31d9-a006-dccc76ff95c0",
              "workstation": "/WA_DA",
              "options": [],
              "saturdayIsFree": true,
              "sundayIsFree": true,
              "runCycles": [],
              "exclusiveRunCycles": [],
              "asap": true,
              "perJobLatestStart": false,
              "matchingCriteria": {
                "type": "sameDay"
              }
            }
          }
        ]
      }
  2. Now, use the ID you retrieved to submit the job stream with the POST/twsd/api/v2/plan/jobstream/{model_jobstream_id}/submit endpoint.
    1. In the Swagger UI, expand the endpoint and paste the job stream ID into the ID parameter field.
    2. In the Request body field, delete the entire content. No request body is required for this action.
    3. Click Execute.
    The API returns a success message with the ID of the job stream in the plan. Your job stream is now scheduled to run in the current plan.
  3. To verify the submission, run the GET/twsd/api/v2/plan/jobstream API endpoint. Confirm that the response body contains the JSON object for the job stream you submitted.