<?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 Reopen selected incidents in &amp;quot;Investigation&amp;quot; tab in Cortex XSOAR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/reopen-selected-incidents-in-quot-investigation-quot-tab/m-p/537220#M1959</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'd like to reopen the incidents selected after a query in Search Incidents. Not the result of the query, only the selected ones after the query, I'm trying to use the API commando to open them:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;body = {"id":f"{incident}","version":version}&lt;BR /&gt;uri = f"/investigation/{incident}/reopen"&lt;BR /&gt;status = demisto.internalHttpRequest('POST', uri, body=body)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Of course, incident is closed so I can't use this call:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;incident = demisto.incidents()[0].get('id')&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I get the internal id variable of the selected incidents without query them?&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-270px"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Josep_0-1680255394333.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/49177i4F8191FBEA2942F0/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Josep_0-1680255394333.png" alt="Josep_0-1680255394333.png" /&gt;&lt;/span&gt;&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>Fri, 31 Mar 2023 09:37:32 GMT</pubDate>
    <dc:creator>Josep</dc:creator>
    <dc:date>2023-03-31T09:37:32Z</dc:date>
    <item>
      <title>Reopen selected incidents in "Investigation" tab</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/reopen-selected-incidents-in-quot-investigation-quot-tab/m-p/537220#M1959</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'd like to reopen the incidents selected after a query in Search Incidents. Not the result of the query, only the selected ones after the query, I'm trying to use the API commando to open them:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;body = {"id":f"{incident}","version":version}&lt;BR /&gt;uri = f"/investigation/{incident}/reopen"&lt;BR /&gt;status = demisto.internalHttpRequest('POST', uri, body=body)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Of course, incident is closed so I can't use this call:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;incident = demisto.incidents()[0].get('id')&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I get the internal id variable of the selected incidents without query them?&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-indent-padding-left-270px"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Josep_0-1680255394333.png" style="width: 400px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/49177i4F8191FBEA2942F0/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Josep_0-1680255394333.png" alt="Josep_0-1680255394333.png" /&gt;&lt;/span&gt;&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>Fri, 31 Mar 2023 09:37:32 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/reopen-selected-incidents-in-quot-investigation-quot-tab/m-p/537220#M1959</guid>
      <dc:creator>Josep</dc:creator>
      <dc:date>2023-03-31T09:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Reopen selected incidents in "Investigation" tab</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/reopen-selected-incidents-in-quot-investigation-quot-tab/m-p/538275#M1981</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/226640"&gt;@Josep&lt;/a&gt;&amp;nbsp;, I have been testing our API recently (tested on both PowerShell and Python), and I was able to reopen closed incidents using the following steps:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.) Search for the closed incidents you want to reopen using the&amp;nbsp;&lt;STRONG&gt;/incidents/search&lt;/STRONG&gt; API endpoint (save these results to a variable)&lt;/P&gt;
&lt;P&gt;2.) Add each of the incidents returned from the query (the incident JSON data) into a list&lt;/P&gt;
&lt;P&gt;3.) Loop through the list and set the uri with an f string with the incident["id"] value (almost exactly as you had before, except we are accessing the id property&lt;/P&gt;
&lt;P&gt;4.) Within the loop, change the incident["version"] value to &lt;STRONG&gt;-1&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;5.) Run the demisto.internalHttpRequest Method inside of the loop using the following:&amp;nbsp;&lt;STRONG&gt;status = demisto.internalHttpRequest('POST', uri, body=incident)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So everything will look like this &lt;STRONG&gt;after you have already searched for the closed incidents and looped through the incidents and added them to a list called "incidents_list" in this example&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for incident in incidents_list:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; incident["version"] = -1&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &lt;SPAN&gt;uri = f"/investigation/{incident["id"]}/reopen"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &lt;SPAN&gt;status = demisto.internalHttpRequest("POST", uri=uri, body=incident)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Could you please give this a try and report back? Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 17:40:40 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xsoar-discussions/reopen-selected-incidents-in-quot-investigation-quot-tab/m-p/538275#M1981</guid>
      <dc:creator>bparmely</dc:creator>
      <dc:date>2023-04-11T17:40:40Z</dc:date>
    </item>
  </channel>
</rss>

