<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: workflow with http request in Automations</title>
    <link>https://community.dynatrace.com/t5/Automations/workflow-with-http-request/m-p/248517#M1621</link>
    <description>&lt;P&gt;Thanks for the question!&lt;/P&gt;</description>
    <pubDate>Tue, 18 Jun 2024 08:09:34 GMT</pubDate>
    <dc:creator>ChristopherHejl</dc:creator>
    <dc:date>2024-06-18T08:09:34Z</dc:date>
    <item>
      <title>workflow with http request</title>
      <link>https://community.dynatrace.com/t5/Automations/workflow-with-http-request/m-p/248497#M1618</link>
      <description>&lt;P&gt;Good morning,&lt;/P&gt;&lt;P&gt;As shown below, it would be nice to use variables in the http request:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="henk_stobbe_0-1718694577183.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20587i3695A8EF8977CA2A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="henk_stobbe_0-1718694577183.png" alt="henk_stobbe_0-1718694577183.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So my questions is this possible, or do I need to write my own fetch request?&lt;/P&gt;&lt;P&gt;&amp;nbsp; And I assume you need multiple returns for multiple variables or is the proper way state or document?&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short what is the proper way for this?&lt;/P&gt;&lt;P&gt;KR Henk&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 07:29:49 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/workflow-with-http-request/m-p/248497#M1618</guid>
      <dc:creator>henk_stobbe</dc:creator>
      <dc:date>2024-06-18T07:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: workflow with http request</title>
      <link>https://community.dynatrace.com/t5/Automations/workflow-with-http-request/m-p/248513#M1619</link>
      <description>&lt;P&gt;You can use the expressions documented at &lt;A href="https://docs.dynatrace.com/docs/platform-modules/automations/workflows/reference" target="_blank"&gt;https://docs.dynatrace.com/docs/platform-modules/automations/workflows/reference &lt;/A&gt;as well as any default jinja2 function (link in the doc).&lt;BR /&gt;We currently do not support defining a fixed set of variables on the workflow to use anywhere (although on the roadmap for this year with the proper introduction of workflow input support and default values in the UI).&lt;BR /&gt;For now, if you want to manage a set of variables in one place to use throughout the workflow, your best bet would be an ad-hoc javascript task that returns the desired data.&lt;BR /&gt;&lt;BR /&gt;Return data can be any json object, so complex, nested objects with any json supported types are possible. for example:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;export default async function ({ execution_id }) {

  return {
    my_string: "Some important string",
    my_number: 42,
    my_list: [1,2,"something else"],
    my_object: {
      my_key: "my value",
      my_other_number: 196,
      my_boolean: true
    }
  };
  
}&lt;/LI-CODE&gt;
&lt;P&gt;will return as shown&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherHejl_0-1718697341607.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20589i25F3DF39B2CC8297/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherHejl_0-1718697341607.png" alt="ChristopherHejl_0-1718697341607.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can access the data using the result expression&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{{ result("my_data_task")["my_object"]["my_key"] }}&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherHejl_1-1718697398124.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20590i21A3648DB58B21F6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherHejl_1-1718697398124.png" alt="ChristopherHejl_1-1718697398124.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: in order to get proper autocomplete suggestion for the results, you'll need to update the sample result of your custom javascript task accordingly. &lt;BR /&gt;You can find that on the Sample Result tab&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherHejl_2-1718697460304.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20591i5DFB48BBA7E1267E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherHejl_2-1718697460304.png" alt="ChristopherHejl_2-1718697460304.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then Edit and update the content.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherHejl_3-1718697505708.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20592iB22210DCED98B7FA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherHejl_3-1718697505708.png" alt="ChristopherHejl_3-1718697505708.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Best way to do this I suggest to run the workflow once first, check the task works as expected and then use the "Sample from task exeuction" button which automatically updates the sample result with the result from the last execution:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChristopherHejl_4-1718697563975.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/20593i4444FD1ED4C92722/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChristopherHejl_4-1718697563975.png" alt="ChristopherHejl_4-1718697563975.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;-----&lt;BR /&gt;Once we add full workflow input (and output) support, you will have a setting in the worklfow do define worklow scoped variables.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 08:00:14 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/workflow-with-http-request/m-p/248513#M1619</guid>
      <dc:creator>ChristopherHejl</dc:creator>
      <dc:date>2024-06-18T08:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: workflow with http request</title>
      <link>https://community.dynatrace.com/t5/Automations/workflow-with-http-request/m-p/248515#M1620</link>
      <description>&lt;P&gt;Great lesson thanks! (-;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 08:06:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/workflow-with-http-request/m-p/248515#M1620</guid>
      <dc:creator>henk_stobbe</dc:creator>
      <dc:date>2024-06-18T08:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: workflow with http request</title>
      <link>https://community.dynatrace.com/t5/Automations/workflow-with-http-request/m-p/248517#M1621</link>
      <description>&lt;P&gt;Thanks for the question!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 08:09:34 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Automations/workflow-with-http-request/m-p/248517#M1621</guid>
      <dc:creator>ChristopherHejl</dc:creator>
      <dc:date>2024-06-18T08:09:34Z</dc:date>
    </item>
  </channel>
</rss>

