REST API - creating a new job definition in the database

Use REST APIs to add a new job definition to the database.

About this task

You can create a job definition by submitting the definition payload through a POST REST API.

Procedure

  1. Prepare the payload template for the new job definition. Modify the fields within the def array with the required values.
    {
        "kind": "JobDefinition",
        "def": {
            "folder": "/",
            "name": "JOB_TEST",
            "workstation": "/RMMYCLDTL16961",
            "type": "UNIX",
            "task": {
                "unix": {
                    "taskString": "ls",
                    "userName": "twsuser",
                    "isCommand": true
                }
            }
        }
    }

    To retrieve supporting information, such as the name of the workstation you want to use, utilize the respective GET endpoint.

  2. Use the POST/twsd/api/v2/model/jobdefinition endpoint to make a POST request.
  3. In the Swagger UI, expand the endpoint, paste the edited payload, and click Execute.
    The API response returns the ID for the new job definition.
  4. Verify that the job definition was created.
    1. Run the GET/twsd/api/v2/model/jobdefinition API call again.
    2. Check that the job definition is present in the results list.