Automic Workload Automation

 View Only

  • 1.  Pass output of first REST response to next REST job

    Posted Oct 09, 2024 09:46 AM

    Hi all,

    question might be simple but i somehow do not get the trick. I have a workflow with 2 REST jobs. In the Precondition of the first i parse a value out of the response and store it as a value. Now: How can i use it in the second job of the workflow as a ressource in the REST call.

    Lets say i have a ressource in the first call called &ID2#. If i assign the value of the first REST call response to a variable with same name this is only visible for the first job, but not replacing the ressource variable with the value correct? So i assume i have to publish it to the workflow, but how can i do that?

    Many thanks,

    Björn



  • 2.  RE: Pass output of first REST response to next REST job

    Posted Oct 10, 2024 02:16 AM
    Edited by Joel Wiesmann Oct 10, 2024 02:18 AM

    Hi Bjoern

    Not sure how you use preconditions to parse data from a task that wasn't started yet. Did you mean postprocess?

    The REST jobs have a response parser that utilizes jsonpath / xpath to extract data. You can use this to store the extracted value directly in a variable that get's published on workflow level. This means, that this variable is available in the suceeding task where you can use it as part of the ressource. Check out the "Web service"/"response" tab of the first REST job. There you can do this in the "Parse a Single Part Response" table.

    If you use postprocess for data extraction, you need to publish the variable up to the parent workflow, so the suceeding task can access it. Best is to utilize the PUBLISH command for that (there are other ways as well, like utilizing a VARA object...).

    In both cases, make sure the suceeding task has the generation at runtime setting.

    Hope this helps, regards
    Joel



    ------------------------------
    ☎️ Swisscom Automation Engineer & 🧙 PE Membership Creator

    Automic Kurse, Tutorials, Tools und mehr auf:
    https://membership.philippelmer.com/
    Zwei Wochen kostenlos testen!
    ------------------------------



  • 3.  RE: Pass output of first REST response to next REST job

    Posted Oct 11, 2024 07:06 AM

    Hi Joel,

    you are completly right, i parsed the response in the response section, but that Generate at runtime checkbox got me (again) ;-)

    So works as i thought it should...again the problem was in front of the..

    Many thanks,

    Björn




  • 4.  RE: Pass output of first REST response to next REST job

    Posted Oct 14, 2024 03:02 AM

    Haha good thing I mentioned that in my very last sentence ;-)!



    ------------------------------
    ☎️ Swisscom Automation Engineer & 🧙 PEM Creator

    Online Automic Training 24/7:
    https://membership.philippelmer.com/ (deutsch)
    https://pemautomic.com (english)
    ------------------------------