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
-
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.
- Use the POST/twsd/api/v2/model/jobdefinition endpoint to make a POST request.
-
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.
-
Verify that the job definition was created.
- Run the GET/twsd/api/v2/model/jobdefinition API call again.
- Check that the job definition is present in the results list.