Automic Workload Automation

 View Only
  • 1.  Importing a schedule object using REST API 12.3

    Posted Feb 19, 2020 08:07 AM
    Hi all,
    I'm trying to import the following object (derived from an exported object) with request:
    http://[server]:8088/ae/api/v1/[client]/objects/?overwrite_existing_objects=true

    {
    "path" : "TEST/SCHEDULE",
    "data" : {
    "jsch" : {
    "general_attributes" : {
    "minimum_ae_version" : "11.2",
    "auto_deactivation" : "A",
    "workflow_children" : "1",
    "name" : "SCHED.TEST",
    "type" : "JSCH",
    "inherit_output_filter" : "N",
    "queue" : "CLIENT_QUEUE",
    "time_zone" : "TZ.GMT.1"
    },
    "schedule_attributes" : {
    "period" : "99",
    "start_time" : "2000-01-01 00:00:00.0"
    },
    "workflow_definitions" : {
    "earliest_start_time" : "001818",
    "object_name" : "1300_J_IVKMDS_0001_JOBP.UC298",
    "object_type" : "JOBP",
    "postcondition_execute_flag" : "1"
    }}}}

    and getting this error

    REST:
    {
    "code" : 45110,
    "error" : "An Automation Engine internal error occured.",
    "details" : "No detail information available."
    }

    Server log:
    U00045098 Method 'POST', URL: 'http://[server]:8088/ae/api/v1/[client]/objects'
    U00045105 Log on of 'XXX' successful.
    U00045197 FileSync: Import object 'JSCH.NEW.1' of type 'JSCH'
    U00045014 Exception 'com.automic.database.api.DBException: "INSERT INTO OSA (OSA_ACTATRUN,OSA_OH_IDNR,OSA_PERIOD,OSA_StartTime) VALUES (?,?,?,?)
    The insert or update value of the FOREIGN KEY "UC4DBUSR.OSA.FK_OSA_OH" is not equal to any value of the parent key of the parent table.. SQLCODE=-530, SQLSTATE=23503, DRIVER=4.17.29"' at 'com.automic.database.impl.DBConnectionImpl.executeInternal():462'.
    U00045015 The previous error was caused by 'com.ibm.db2.jcc.am.SqlIntegrityConstraintViolationException: "DB2 SQL Error: SQLCODE=-530, SQLSTATE=23503, SQLERRMC=UC4DBUSR.OSA.FK_OSA_OH, DRIVER=4.17.29"' at 'com.ibm.db2.jcc.am.hd.a():743'.
    U00045099 The server replied with following status: '500'

    Any idea what could be the reason for this problem?

    ------------------------------
    IT Architect
    IBM Germany
    ------------------------------


  • 2.  RE: Importing a schedule object using REST API 12.3

    Posted Feb 24, 2020 07:58 AM
    Edited by Antoine Sauteron Feb 24, 2020 07:59 AM
    ​Hi Thomas,

    Does the object in this section

    "workflow_definitions" : {
    "earliest_start_time" : "001818",
    "object_name" : "1300_J_IVKMDS_0001_JOBP.UC298",
    "object_type" : "JOBP",
    "postcondition_execute_flag" : "1"

    already exist in the client ?

    Best regards
    Antoine




  • 3.  RE: Importing a schedule object using REST API 12.3

    Posted Feb 24, 2020 11:12 AM
    Hi Antoine,

    yes, this JOBP exists already. The schedule import object is derived from an export.
    I can start the JOBP directly by the execution service and I'm currently check if this (as recurring task) could be an alternative for schedules ... if this is not working.

    Regards,
    Thomas

    ------------------------------
    IT Architect
    IBM Germany
    ------------------------------



  • 4.  RE: Importing a schedule object using REST API 12.3

    Posted Feb 25, 2020 04:46 AM
    Edited by Antoine Sauteron Feb 25, 2020 04:47 AM
    Hi Thomas,

    The insert or update value of the FOREIGN KEY "UC4DBUSR.OSA.FK_OSA_OH" is not equal to any value of the parent key of the parent table.

    The foreign Key FK_OSA_OH refers to OSA_OH_Idnr​. In your case it seems the application is looking for a corresponding entry (assumably in the OH table) and fails to find it.

    To confirm this you can try to look for the JSCH's Idnr :

    SELECT OH_Idnr
    FROM UC4DBUSR.OH
    WHERE OH_NAME = 'SCHED.TEST';

    Then search for this Idnr in OSA

    SELECT *
    FROM UC4DBUSR.OH
    WHERE OSA_OH_Idnr ='<OH_idnr from previous SQL>';

    Best regards,
    Antoine


  • 5.  RE: Importing a schedule object using REST API 12.3
    Best Answer

    Posted Feb 24, 2020 08:14 AM
    Edited by Diane Craddock Mar 03, 2020 08:55 AM
    Hi Thomas,

    your script works for me exactly like it is, no changes needed. Folder and object get created, period is set to 99. Of course the JOBP will not be created, neither the TZ. 




    Cheers
    Christoph 





    ------------------------------
    ----------------------------------------------------------------
    Automic AE Consultant and Trainer since 2000
    ----------------------------------------------------------------
    ------------------------------



  • 6.  RE: Importing a schedule object using REST API 12.3

    Posted Feb 25, 2020 08:33 AM
    Hi Christoph,

    thanks a lot, that was a interesting hint. Before I tested the service with an REST call implemented in a Java application. With your hint I tried it once more with Postman and it works. So I analyzed the differences and the reason/solution is very strange and I think a bug in the REST processing in AWA.

    Usually the order should not matter in JSON, but it does here! The position of the "schedule_attributes" under "jsch" is relevant, so the JSON is not processed correctly (see JSON below).

    Working JSON:
    {
      "path": "TEST/SCHEDULE",
      "data": {
       "jsch": {
        "general_attributes": { ... },
        "schedule_attributes": { ... },
        "workflow_definitions": { ... }
    }}}

    NOT WORKING!!!
    {
      "path": "TEST/SCHEDULE",
      "data": {
       "jsch": {
        "schedule_attributes": { ... },
        "general_attributes": { ... },
        "workflow_definitions": { ... }
    }}}

    My problem was that I have (normaly) no influence to the order of the JSON if I use a JSONobject class in Java to create the JSON. I fixed the order in the JSON with some String operations as workaround and ... now it works for me even with the Java application.

    But the parsing problem should be fixed for the AE REST API and why this is related to an foreign key error in the DB.

    ------------------------------
    IT Architect
    IBM Germany
    ------------------------------



  • 7.  RE: Importing a schedule object using REST API 12.3

    Posted Feb 25, 2020 08:39 AM
    Hi ​@Thomas Loehnert

    You may want to report the issue via casupport.broadcom.com. ​It is extremely unlikely (in fact I have yet to witness this) that Broadcom will pick up bug reports from the community forums.


    As for AE spewing error messages that seem unrelated: I agree this this isn't the way it should be, but I have also seen many instances where this has been ruled as being "by design". I suggest report it along with the actual bug nonetheless, but wouldn't get my hopes up high for that one.

    Just my €0.02 / best regards,

    Carsten