search cancel

Unable to import JIL using Web Services


Article ID: 214790


Updated On:


CA Workload Automation AE


When trying to import JIL using Web Services, the following error is displayed:

curl -X POST -H "Content-Type: text/plain" -d @<file_name> https://hostname:port/AEWS/jil -k --user "<user>:<password>" -i

Where <file_name> is a flat file containing a standard JIL definition like this:

update_job: <job_name>   job_type: CMD 
command: <command>
machine: <machine>
owner: <user>

Output of curl command:

HTTP/1.1 406
Content-Type: application/json
Transfer-Encoding: chunked
Date: Fri, 23 Apr 2021 11:01:54 GMT

{"output":["______________________________________________________________________________","","CAUAJM_I_50323 Inserting/Updating job: <job_name>","CAUAJM_E_18917 Invalid keyword specified: <command>command","CAUAJM_E_18917 Invalid keyword specified: <args>machine","CAUAJM_E_18917 Invalid keyword specified: <machine>owner","CAUAJM_E_18917 Invalid keyword specified: <owner>permission","CAUAJM_E_18917 Invalid keyword specified: 0alarm_if_fail","CAUAJM_E_18917 Invalid keyword specified: 1alarm_if_terminated","CAUAJM_E_18936 Required JIL keyword \"command\" is missing.","CAUAJM_E_18936 Required JIL keyword \"machine\" is missing.","CAUAJM_E_10302 Database Change WAS NOT successful.","______________________________________________________________________________","","CAUAJM_E_50198 Exit Code = 1","______________________________________________________________________________",""],"rc":"1","status":"failed"}



The JIL file contents are being interpreted as one long string, rather that having a break between lines.


AutoSys 12.x Web Services


Rather than using the -d @<file_name> option in the curl command, use the --upload-file "<file_name>" option instead, like this:

curl -X POST -H "Content-Type: text/plain" --upload-file "<file_name>" https://hostname:port/AEWS/jil -k --user "<user>:<password>" -i

Here is an example:

$ cat testjob_aews_insert.jil

update_job: testjob_aews   job_type: CMD 
command: sleep 10
owner: autosys
date_conditions: 0
description: "This is a test job update"
curl -X POST -H "Content-Type: text/plain" --upload-file "testjob_aews_insert.jil" -k --user "barcop:<password>" -i

HTTP/1.1 100 

HTTP/1.1 200 
Content-Type: application/json
Transfer-Encoding: chunked
Date: Mon, 10 May 2021 21:33:36 GMT

{"output":["______________________________________________________________________________","","CAUAJM_I_50323 Inserting/Updating job: testjob_aews","CAUAJM_I_50205 Database Change WAS Successful!","______________________________________________________________________________","","CAUAJM_I_52301 Exit Code = 0","______________________________________________________________________________",""],"rc":"0","status":"success"}

Alternatively, the original curl command with the -d @<file_name> will work successfully but only if you add a leading empty space before each line in the JIL file.

Example with leading empty space highlighted in grey:

 update_job: <job_name>   job_type: CMD
 command: <command>
 machine: <machine>
 owner: <user>